Skip to content

Markup Spec

zachzurn edited this page Jul 15, 2025 · 4 revisions

Lexical elements:

TEXT = Any text separated by newlines AN = Alpha numeric NAME = alphanumeric characters, "-", "_", WS = Any contiguous whitespace or newlines PLUS = "+" COLON = ":"

OB = "[" CB = "]"

OS = "{" CS = "}"

OT = "<" CT = ">"

RAW = "|=" can't be preceded with a backslash

STYLE = NAME|WS?|COLON|WS?|NAME)? STYLE_SEP = WS?|PLUS|WS? STYLE_LIST = STYLE+|WS

Components: We will use pipe (|) to separate components. Parenthesis are groups. ? means optional. + means can match multiple times in a row.

TEXT_CONTAINER: Any text, separated by newlines

STYLE_ALIAS: Format = OS|WS?|NAME|WS|=|WS?|STYLE_SEP|STYLE_LIST|CS Example = "{ !customStyle = bold+italic+fontSize:3}"

RAW_CONTAINER: Format = RAW|ANY|RAW Example = "|= Anything goes in here and is |= =| not parsed. =|"

BOX_CONTAINER: Format = OB|STYLE_LIST|WS|(RAW_CONTAINER, BOX_CONTAINER, TAG_CONTAINER, STYLE_CONTAINER, TEXT_CONTAINER)+|WS?|CB Example = "[bold+italic This is some text [ This is a box ] ]"

TAG_CONTAINER: Format = OT|NAME|CT Example = "<this_is_a-tag>"

Styles must be declared at the top of the document. Otherwise they will be parsed as text

Document Example:

{ redBox = 
    + colorText: red
    + pad: 2
}

{ 
    anotherRedBox = 
        + colorText: red
        + pad: 2
}

{ header = bold + sizeText: 2  }

[redBox This box will be red with some padding ]

This is some text [ This is in a box ] and [ Some more ]

[flex
    [ Some text on the left ] <-> [Some text on the right ]
]

[table
    [header [ a column ] [ a column ] ]
    [ [ a column ] [ a column ] ]
    [ [ a column ] [ a column ] ]
]

This is some raw |= text that can have [ literal text in it ] =|

[bold + italic
  A box with text in it
]

[small + 
 large +
 italic
  This is a box with text [ And another ] 
]
Clone this wiki locally