sigil-markdown / tree / bench / corpusmixed.md
Slate Rendering Pipeline
This is a representative folio note that exercises most of the block and inline constructs the parser handles. It mixes inline code, links, and bold with nested italic so the inline PEG grammar sees real work.
Background
The reading-view render path in Slate calls markdown->sxml on every note. When a whole folio is rendered by default, this runs hundreds of times, so per-render cost matters. See the design doc for context.
Some paragraphs are long and wrap across multiple source lines to stress the paragraph accumulation loop, which joins lines with a single space before running the inline parser over the entire joined string. This is where a lot of the plain-text scanning happens, because every character passes through the text-run negative-lookahead gauntlet in the inline grammar.
Inline stress
Here we have code spans, strong, also strong, em, also em, a named link, an , and an escaped * asterisk. Mixing them: bold
code inside and italic link.
Lists
- First unordered item with some bold text
- Second item with
inline codeand a link - Third item that is long enough to wrap and contains emphasis plus more words to push the inline scanner along a longer run of plain characters here
- Fourth item
- Ordered item one
- Ordered item two with
code - Ordered item three
Code
(define (markdown->sxml text)
(let* ((lines (string->lines text))
(blocks (parse-blocks lines)))
(map block->sxml blocks)))indented code block with two lines
Quote
A blockquote line with bold and a link. Second quoted line continuing the same quote block.
Table
| Feature | Native | Wasm | Notes |
|---|---|---|---|
| Headings | fast | ok | cheap PEG match per line |
| Inline code | medium | slow | per-char lookahead in grammar |
| Tables | medium | slow | many parse-inline calls |
| Paragraphs | slow | slow | long joined text runs |
Horizontal rule
Closing
A final paragraph with a trailing reference link and some inline code to make sure the tail of the document still parses cleanly and the inline grammar terminates without backtracking blowups on plain text runs.