Glyph - Escaping and Quoting

← Macro Composition | Contents | Sections and Headers →

Glyph doesn’t require any special control characters like LaTeX, and its macro syntax is very straightforward and liberal. This however comes with a price: because square brackets are used as delimiters, you must escape any square bracket in your text with a backslash. That’s not too bad if you think about it, unless you’re writing programming code, in which case escaping every single square bracket can be painful.

If a portion of your text contains an excessive amount of square brackets, you may consider using the escape macro (or its alias .) with the [= and =] delimiters. By itself, the escape macro doesn’t do anything: it just evaluates to its contents, but the special delimiters act as an escape for any square bracket within them. As a consequence, any macro within [= and =] will not be evaluated.

You can use the quoting delimiters with any macro identifier. Obviously, using them as delimiters for things like section macros may not be a good idea, but they should be more or less mandatory with the codeblock macro or the highlight macro, especially when it contains square brackets or even Glyph code, like this:

 1codeblock[=
 2  section[
 3    @title[A section]
 4    @id[test]
 5This is a section.
 6    section[
 7    @title[A nested section]
 8This is another section.
 9    ]
10  ]
11=]
NoteAlthough quoting delimiters allow you to use square brackets without escaping them, you must still escape them if you want to escape quoting delimiters themselves.

Besides square brackets, there are other characters that must or can be escaped with backslashes, as shown in the following table:

Escape Sequence Evaluates to... Notes
\[ [ Square brackets must be escaped unless used as macro delimiters or within a quoting macro.
\] ] Square brackets must be escaped unless used as macro delimiters or within a quoting macro.
\\ \ Backslashes do not have to be escaped by default, but an escaped backslash will evaluate to itself.
\= = Equal signs do not have to be escaped by default, but an escaped equal sign will evaluate to iself.
\| | Pipes must be escaped (even within quoting macros) unless they are used to separate macro parameters.
\/ An escaped dot evaluates to nothing. Useful to separate macro identifiers from other characters:
_\/=>[#link|This link is emphasized using Textile]_
← Macro Composition | Contents | Sections and Headers →