AtlatestRepositorysigil-markdown
sigil-markdown / tree / bench / corpusmixed.md
1
---2
title: Representative Folio Note3
tags: slate, performance, markdown4
created: 2026-07-205
status: draft6
---8
# Slate Rendering Pipeline10
This is a **representative** folio note that exercises *most* of the block and11
inline constructs the parser handles. It mixes `inline code`, [links](https://example.com),12
and **bold with _nested italic_** so the inline PEG grammar sees real work.14
## Background16
The reading-view render path in Slate calls `markdown->sxml` on every note. When a17
whole folio is rendered by default, this runs hundreds of times, so per-render cost18
matters. See the [design doc](https://sigil.org/docs/markdown) for context.20
Some paragraphs are long and wrap across multiple source lines to stress the21
paragraph accumulation loop, which joins lines with a single space before running22
the inline parser over the *entire* joined string. This is where a lot of the23
plain-text scanning happens, because every character passes through the text-run24
negative-lookahead gauntlet in the inline grammar.26
### Inline stress28
Here we have `code spans`, **strong**, __also strong__, *em*, _also em_, a29
[named link](https://codeberg.org/sigil), an , and an30
escaped \* asterisk. Mixing them: **bold `code` inside** and *italic [link](x)*.32
## Lists34
- First unordered item with some **bold** text35
- Second item with `inline code` and a [link](https://example.com)36
- Third item that is long enough to wrap and contains *emphasis* plus more words37
to push the inline scanner along a longer run of plain characters here38
- Fourth item40
1. Ordered item one41
2. Ordered item two with `code`42
3. Ordered item three44
## Code46
```scheme47
(define (markdown->sxml text)48
(let* ((lines (string->lines text))49
(blocks (parse-blocks lines)))50
(map block->sxml blocks)))51
```53
indented code block54
with two lines56
## Quote58
> A blockquote line with **bold** and a [link](https://example.com).59
> Second quoted line continuing the same quote block.61
## Table63
| Feature | Native | Wasm | Notes |64
|:-------------|:------:|------:|:------------------------------|65
| Headings | fast | ok | cheap PEG match per line |66
| Inline code | medium | slow | per-char lookahead in grammar |67
| Tables | medium | slow | many `parse-inline` calls |68
| Paragraphs | slow | slow | long joined text runs |70
## Horizontal rule72
---74
## Closing76
A final paragraph with a trailing [reference link](https://example.com) and some77
`inline code` to make sure the tail of the document still parses cleanly and the78
inline grammar terminates without backtracking blowups on plain text runs.