What Markdown builds
The HTML Statac writes for each piece of a page's Markdown, and how to write your own.
What Statac writes for each piece of a page’s content, and for text a
template builds with the markdown filter. A file in
snippets/markdown/ replaces Statac’s HTML for one piece: see
build headings, links and code your own way.
Without a file of your own
| Piece | Statac writes |
|---|---|
| A heading | <h2 id="getting-there">Getting there</ |
| A link | <a href="/ |
| An image | A <picture> listing the image’s resized copies, or an <img>. See the HTML Statac writes. |
| A code block | <pre class="code"><code class="language-rust">let x = 1;</, and with a caption <figure class="code"><figcaption>The caption</ |
| Inline code | <code>let x = 1;</ |
| A footnote marker | <sup class="footnote"><a href="#note-1" id="back-1">1</ |
| The footnotes | <section class="footnotes"><ol><li id="note-1"><p>The footnote. <a href="#back-1" class="back" aria-label="back to the text">↩</, with the arrow ↪ instead if page.direction is rtl |
| A callout | <aside class="callout note"><p>The content.</ |
| A table | A <table> inside <div class="scroll">, with the table’s id and classes, a <thead> holding the heading row, and a <tr> for each other row |
A footnote’s id is note-1 and its marker’s is back-1, which Statac
numbers in the order of the footnotes. If you have already given
something on the page one of these ids, such as a heading’s {#note-1},
Statac adds -1 to its own, or the next free number: note-1-1.
With a file of your own
Statac hands the file the values that
Names a template is handed lists for it, and
page and site, and writes what the file writes. A body is HTML
that Statac built, and {{ body }} writes it into the page without
escaping it.
If the file for a heading, a code block, a callout, a table or the footnotes writes only spaces, Statac writes nothing in that piece’s place.
In the markdown filter
| In the text | How Statac builds it |
|---|---|
| Maths | The same way as in the content. |
| A snippet call | Statac leaves it unchanged. |
| A link, a code block, inline code, a callout, a table | With the site’s own file in snippets/markdown/ for it, if the site has one. Statac doesn’t colour a code block. |
| A heading, an image, a footnote | The way Statac builds them, even if the site has a file for them: a heading has no id, Statac leaves an image’s URL unchanged, and it numbers footnotes from 1 in each value, with the ids note-1 and back-1. |
Warning
If two values on one page have footnotes, or one value does and the
page has footnotes of its own, the ids note-1 and back-1 appear
more than once on the page, and Statac doesn’t warn you.
Something unclear or wrong? Open an issue.