Example:
[box id="main" width=800 height=600] {
[box .title] {
Game Menu
}
[box] {
[box .primary width=8em height=2em] { Start }
[box width=8em height=2em] { Options }
[box .danger width=8em height=2em] { Quit }
}
[box bg-color=#f0f0f0] {
Some text with background color
}
[box] {
Some text
[image src="path/to/image.png" width=100 height=100]
[image src="path/to/image2.png" width=100 height=100]
}
[box] {
Multiline text
is on
multiple lines
[box font="path/to/font.ttf" font_size=13] { Some other text }
How to "escape" quotes
}
[box] {
[box width=50%] {
Left box content
}
[box width=50%] {
Right box content
[image src="path/to/image.png" width=100 height=100]
}
}
}
The markup language also supports CSS-like [style] blocks for defining reusable styles. See Style documentation for details.
box, text, width.100, 50.5.Game Menu.%, e.g. 50%.em, e.g. 2em.#, e.g. #FF0000 or #FF000080.= sign used to bind attributes to values (whitespace around = is allowed).{ and } used to group children inside an element.: used in style property declarations.; used to terminate style properties.. prefixed to class names for assignment and selectors in styles.$ prefixed to IDs for assignment and selectors in styles.// to end of line or /* */ block comments (comments are skipped by the lexer).[ and ] used to enclose tag + attributes.markup ::= element*
element ::= '[' identifier attribute* ']' '{' (element | text)* '}'
attribute ::= identifier '=' (string | number | number '%' | number 'em' | '#' hexdigit{6,8} | identifier) | '.' identifier | '$' identifier
string ::= '"' (any char except '"' and '\' | '\\' ('"' | '\' | 'n' | 't' | 'r'))* '"'
text ::= (any char except '{' '}' '[' ']')*
number ::= digit+ ('.' digit+)?
identifier ::= letter (letter | digit | '_' | '-')*
digit ::= '0'-'9'
hexdigit ::= '0'-'9' | 'a'-'f' | 'A'-'F'
letter ::= 'a'-'z' | 'A'-'Z'
[] with a tag. Values may be quoted strings, identifiers, numbers, percentages, or colors. Whitespace around = is allowed..classname syntax.$id syntax.# prefix, e.g. #FF0000 (RRGGBB) or #FF000080 (RRGGBBAA).\" to escape quotes, \\ for backslash, and common escapes \n, \t, \r are supported.