Extensions
The directive syntax and the LibreTimes block extensions built on it
Beyond CommonMark, GFM, math, and code, LibreTimes adds a family of block extensions: theorem-style statements, callout boxes, figures with captions, collapsible sections, tabs, TikZ diagrams, video embeds, mentions, and attachment links. Almost all of them share one syntax, so learn it once and every block on the following pages is a vocabulary lookup.
The directive syntax
A block directive is a fenced region opened by three (or more) colons and a name, and closed by a matching line of colons:
:::name[label]{attributes}
Any Markdown content.
:::Three parts, two of them optional:
name— which block this is:theorem,note,figure,spoiler,tabs,tikz, ...[label]— optional text in square brackets on the opening line. What it means depends on the block: the theorem's name, the spoiler's summary.{attributes}— optional{key=value}or{#id}pairs. Used by figures ({#fig1}) and tabs ({name="Python"}).
The body is ordinary Markdown — paragraphs, math, lists, code, even other directives.
Nesting
To nest one directive inside another, give the outer fence more colons than the inner:
::::proof
The map factors as shown:
:::tikz
\begin{tikzpicture} ... \end{tikzpicture}
:::
::::(Equal-depth nesting written by the LibreTimes editor is also repaired automatically at render time, but when writing by hand, more colons outside is the rule.)
Unknown names
A directive whose name is not in the vocabulary is shown exactly as you typed
it: the :::theorm line and the closing ::: appear as text, and the body
between them still renders as ordinary Markdown. Nothing breaks, and the typo
is visible on the page. To display literal directive syntax (as this page
does), put it in a code block.
The vocabulary
Every name the dialect knows, generated from its definition:
| Construct | Directives | Form | Own keys | What it is |
|---|---|---|---|---|
| Statements | :::theorem :::lemma :::corollary :::conjecture :::definition :::proof :::example :::remark :::problem :::solution :::hint :::statement |
block | number label |
Theorem-style blocks with a run-in label. |
| Admonitions | :::callout :::note :::tip :::important :::warning :::caution |
block | label |
Boxed callouts with a title bar. |
| Figures | :::figure |
block | — | One image, diagram or gallery with a caption. |
| Galleries | :::gallery |
block | — | Several images shown as one group. |
| Collapsible sections | :::spoiler |
block | — | A section that stays closed until the reader opens it. |
| Tabs | :::tabs :::tab |
block | group name |
Alternatives side by side, one shown at a time. |
| TikZ diagrams | :::tikz |
block | bg |
A diagram drawn in TikZ, compiled when you save. |
| Book constructs | :::verse :::epigraph :::dedication :::letter :sc[…] :pb[…] |
block, inside a sentence | — | Verse, epigraphs, letters, small capitals and printed page numbers. |
| Attachments | :attach[…] |
inside a sentence | id |
A link to a file attached to the work. |
Two inline extensions use their own syntax rather than directives:
video embeds (@[youtube](...))
and mentions
(@username).
The inside a sentence rows are text directives, the one-colon form
:name[…]{…} that sits in a line of prose.