---
Tags

Tags usually start with a ` and one or more characters.
Invalid "stray" ` characters are treated as plain text.

---
Formatting

Formatting tags are inline. They apply immediately starting at their position.

Formatting tags are:
- bold toggle: `!
- italic toggle: `*
- underline toggle: `_

Styles apply from the point they are defined:

$ normal text, `!bold`!, `*italic`*, `!`*bold and italic``, normal text .

---
Color

Color tags are:
- foreground set: `F123 (123 is the hex color, i.e. #112233)
- foreground reset: `f
- background: `B123 (123 is the hex color, i.e. #112233)
- background reset: `b

If the background color tag is not closed before the end of the line,
it is treated as a full-width background. For example:

$$$
`c
`Fe2e
{ this is now a full-width pink background }
{ pink background left of centre }Centered Text{ pink background right of centre}
`f
$$$

---
Alignment

Alignment tags are:
- set default: `a
- set left: `l
- set center: `c
- set right: `r

Alignments apply at line level, starting the line they are defined, even if at the end of the line.

$$$
Right-aligned text`r
Also right-aligned text
Centre-aligned`c text
Default-aligned/reset text``
`rRight-aligned text
`rRight-aligned text
$$$

Since Alignment tags set the alignment, setting a new one simply overwrites the previous one:

$ `c`r`r this text is right aligned
$ `c`c`r this text is right aligned

---
Reset

The Reset tag is:
- ``

The reset tag resets formatting, color, and alignment.

---
Sections

Sections have the following tags:
- Section start, number of tags denote level: >
- Section start with header: >Header text here
- Section reset: <

Sections must start and end at a newline. Characters following a section reset are handled as normal.

$$$
>>>This is a section level 3 header
this is a section level 3 body
this is still a section level 3 body <
< but this is not a section body
$$$

$ This is not a section >>>

Section headers can also contain formatting, with some special rules:
- Section header Styles have their own scope: they have their own default Style, and any explicit styling is contained to the header only. Any previously defined Style is re-applied after the header. Background color set before the first character in a heading applies also to the indented space in that header.
- Alignment is set and inherited as normal

$$$
>>`!This header is bold
but this body is not
$$$

$$$
>>`*This header is italic and right-aligned`r
this body is not italic, but it is right-aligned
$$$

Sections should indent themselves and their content according to the section level.
Indentation applies on both right and left side. For example, a centered Line at indentation level 10 will be a shorter, centered Line.

---
Lines

A Line has the following tags:
- Define a line: -
- Define a custom line: -X (where X is any unicode character)

Lines are a horizontal line/ruler. If a custom line character is defined, that character is repeated.
A Line tag must start at a newline.
Any extra characters following the Line tag are ignored.

---
Escape

Escape has the following tag:
- Escape next character: \

Any escaped character/tag must render as if it were text.

$ This text is \`!not bold\`!

---
Literal

Literal has the following tag:
- Toggle literal mode: `=

A literal toggle must be at the start of the line
$$$
`=
Literal mode on
`=
Literal mode off
$$$

$ `=Literal mode toggled
$ Literal mode `= not toggled

Literal mode means no tags are interpreted; they are treated as plain text.
While no tags or formatting can be used inside a literal block, any formatting or sections etc defined before the literal tag will apply to content inside the literal tag.
