Skip to content
Charles Dong edited this page Nov 2, 2024 · 15 revisions

Introduction

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}}$$.

Tag types

There are two types of tags: ANSI and behavioral.

ANSI tags

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:

<CYAN;B>
<FG;10;10;10>

For the full list of the ANSI tags, see here.

Behavioral tags

Behavioral tags look slightly different from the ANSI tags, as they begin with an exclamation mark (!) after the <.

Currently, there are three types of behavioral tags supported: <!TAB> (Tab), <!LF> (Line feed), and <!CR> (Carriage return).

Repetition

Behavioral tags can be repeated using a suffix starting with a star (*) and following a number of times, for example:

<!TAB*5>

means 5 tabs.

Clone this wiki locally