Expand description
The Kernsetzer Markdown dialect (M1 extends the M0 subset, see checklist).
Title: Der Leuchtturm <- front matter: `Key: value` lines at the top
Author: Lena Brandt keys: Title, Subtitle, Author, Lang,
Lang: de Publisher, Copyright (or Rights),
Dedication; or a YAML block between
`---` lines (see `front_matter.rs`).
Without `Lang:`, English or German is
detected from the text, as for .docx
*For Ada, who asked first.* <- before the first heading: a paragraph
starting like a dedication (For, To, Für,
In memory, Gewidmet, …) is a Dedication
section; up to three more right after it
join it, 300 characters in all. Italic
over a whole paragraph is dropped
# Chapter title <- new chapter
# Prolog / # Prologue <- recognized section kinds (also Epilog, …)
# Interlude {-} <- an unnumbered chapter (also `{.unnumbered}`,
as in Pandoc): no label, counting skips it
## Subheading <- heading inside the section; `##` is level 1,
`###` level 2, … up to `######`
> Quoted text, lines joined. <- block quote; a bare `>` line separates
> paragraphs, a blank line ends the quote
> Second paragraph.
Paragraphs are separated by blank lines. *Emphasis*, _emphasis_, **strong**,
[small caps]{.smallcaps} (a Pandoc span; other `{…}` attributes are dropped),
2^nd^, H~2~O (superscript, subscript: no spaces inside, `~~` is text),
[links](https://example.com "title") and <https://example.com>.
Dear Anna,\ <- a trailing `\` is a line break (paragraphs,
the house is sold. quotes, notes); on a last line it is dropped
:::verse <- verse: every line is kept, a trailing `\`
How doth the little crocodile is allowed; blank lines separate stanzas;
Improve his shining tail, ends at `:::` (or, with a warning, before
the next heading or at the end). Leading
How cheerfully he seems to grin, spaces indent a line: one level per four
::: (a tab is four), counted from the least-
indented line, up to six levels
:::epigraph <- epigraph: text joined like a paragraph
Every coast is a rumour\ (blank lines become line breaks); a last
until someone draws it twice. line starting with a dash is the
— Harbour saying attribution, plain text. After a `#`
::: heading: the section's epigraph; before
the first heading: an Epigraph section;
elsewhere a block quote. Ends like verse

<- image on a line of its own: alt text, path
(relative to the manuscript; `<…>` or plain,
spaces allowed), optional "caption"; Pandoc
attributes after it size and place it:
`{width=50%}` (rounded to 5, 10–100),
`{.beside}` + `.outside` `.inside` `.left`
`.right`, `{.page}`, `{.bleed}`, combined
as `{.beside .left width=35%}`; others
are ignored
Table: Lydia, my love <- caption (Pandoc): a `Table: text` line
| Day | Miles | alone in its paragraph, right above
|:----|------:| the table or after one blank line, or
| 1 | 14 | the same below it; shown above, and one
above wins over one below. This is a
pipe table: a header row, a delimiter
row, rows; outer pipes optional, `\|`
is text, cells hold emphasis, links and
notes. The delimiter row sets each
column's alignment (`:--` left, `--:`
right, `:-:` centre, `---` left). The
header row is the header, none when all
of it is empty (`| | |`). A short row
is padded; cells beyond the header's
count are left out, and a table with no
text is dropped: `TableSimplified`.
Merged cells cannot be written here
- Rope, *the long one*, <- list: `-`, `*` or `+` items, or `1.`/`1)`;
and the hooks. lines joined; after a blank line another
- Matches item continues it and an indented line
(2 spaces, tab) is a second paragraph;
Keep them dry. deeper-indented items nest. Starts after
- in the tin box a blank line or a block, never inside a
1. Walk to the pier. paragraph. Ordered: starts at 1, two items
2. Wait for the tide. at least ("3. Oktober …" is text).
Items counting on from another number
("8.", "9.") are numbered paragraphs,
with a `ListFlattened` warning
A footnote mark[^1] goes on the word; the definition can be anywhere:
[^1]: Note text, lines joined; after a blank line,
an indented line (tab or 4 spaces) starts its second paragraph.
Ver­legenheit <- soft hyphen (or U+00AD itself): the
author's own hyphenation point
<!-- TODO: the year --> <- HTML comment: never printed, also over
several lines; an unclosed `<!--` is text
*** <- scene break (also `* * *`, `#`, `~~~`)
\newpage <- page break (also `\pagebreak`); dropped at
the start or end of a sectionFunctions§
- import
- Import a manuscript. The parser does no I/O:
filesreturns the bytes of an image path as written in the manuscript (relative to it), orNoneif there is no such file. Each path is asked for once. Pass|_| Nonewhen no files are at hand; images then warn as missing.