-
Notifications
You must be signed in to change notification settings - Fork 0
Syntax
A format string may contain some special symbols (a.k.a. "tags") that can be parsed into ANSI escape codes.
For example:
I'm <B>bold</> and <BLUE;B>blue</>.
can be parsed into
I'm bold and
$${\textbf{\color{blue}blue}}$$ .
There are two types of tags: ANSI and behavioral.
ANSI tags are parsed into ANSI escape codes under the format like \x1b[...m, such as:
| Tag | Target code | Description |
|---|---|---|
<B> |
\x1b[1m |
Bold font |
<CYAN> |
\x1b[36m |
Cyan foreground |
</> |
\x1b[0m |
Reset |
Multiple continuous ANSI tags or ANSI escape codes delimited with ; can be combined into one with
the same delimiter, and numbers will be directly put into the target ANSI code:
<CYAN;B>
<FG;10;10;10>
For the full list of the ANSI tags, see here.
Behavioral tags look slightly different from the ANSI tags, as they begin with an exclamation point (!) after the left angle bracket (<).
Currently, there are three types of behavioral tags supported: <!TAB> (Tab), <!LF> (Line feed), and <!CR> (Carriage return).
Behavioral tags can be repeated using a suffix started with a star (*) and followed by a number of times, for example:
<!TAB*5>
means 5 tabs.
If you do not want your < to be treated as the start of a tag, you can use a backslash (\) to escape it. Also,
there is no need to escape >:
\<not a tag!>