Tour: Block Headers

Any block can have a header. Named blocks have their header behind their name, while the primary block has its header after the colon that starts the block list. A block header may consist of a configuration, a capture list and a swallow indicator. If more than one of those are given, they must be separated by additional colons “:”.

A block configuration customizes the parser while processing this block. It starts with a “<”, ends with a “>”, and separates its items with commas “,”. It can have zero or more items, with each item having the structure “<name> <params>”.

Command characters can be customized via “map <a> <b>”, “csym <a>” and “off <a>”. These can be used if you want to enter text that will contain a character that would usually be a command character. You can either disable that character completely, or map it to a different, unused character.

map takes two characters which must both be in one of the unicode categories M (marks), P (punctuation) or S (symbols). The first character must be a command character in the outer level, the second character must not. Inside the new block, a will not be a command character anymore, and b will instead be one which provides access to the namespace of a.

off disables the given character a, which must be either a command character, “#” (disabling comments) or “:” (disabling block names). You can use off without arguments to disable all command characters as well as comments and block names.

csym enables a to be a new command character (with the same requirements as for map). This gives you a separate namespace to import symbols to.

Regardless of what you do to command characters, you will always be able to end the block list with the “\end(…)” structure. The parser has a lookahead that checks for the current identifier inside that structure and will parse it only as block list end if the identifier is the expected one. You can change the expected identifier with a “= <identifier>” in a call's argument list to give you full control of how the block ends.