AtlatestRepositorysigil-markdown
sigil-markdown / tree / bench / goldenmixed.sxml
1
(document (@ (title "Representative Folio Note") (tags "slate, performance, markdown") (created "2026-07-20") (status "draft")) (h1 "Slate Rendering Pipeline") (p "This is a " (strong "representative") " folio note that exercises " (em "most") " of the block and inline constructs the parser handles. It mixes " (code "inline code") ", " (a (@ (href "https://example.com")) "links") ", and " (strong "bold with " (em "nested italic")) " so the inline PEG grammar sees real work.") (h2 "Background") (p "The reading-view render path in Slate calls " (code "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 " (a (@ (href "https://sigil.org/docs/markdown")) "design doc") " for context.") (p "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 " (em "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.") (h3 "Inline stress") (p "Here we have " (code "code spans") ", " (strong "strong") ", " (strong "also strong") ", " (em "em") ", " (em "also em") ", a " (a (@ (href "https://codeberg.org/sigil")) "named link") ", an " (img (@ (src "img/logo.png") (alt "image"))) ", and an escaped " "*" " asterisk. Mixing them: " (strong "bold " (code "code") " inside") " and " (em "italic " (a (@ (href "x")) "link")) ".") (h2 "Lists") (ul (li "First unordered item with some " (strong "bold") " text") (li "Second item with " (code "inline code") " and a " (a (@ (href "https://example.com")) "link")) (li "Third item that is long enough to wrap and contains " (em "emphasis") " plus more words to push the inline scanner along a longer run of plain characters here") (li "Fourth item ")) (ol (li "Ordered item one") (li "Ordered item two with " (code "code")) (li "Ordered item three")) (h2 "Code") (pre (@ (lang "scheme")) "(define (markdown->sxml text)\n (let* ((lines (string->lines text))\n (blocks (parse-blocks lines)))\n (map block->sxml blocks)))") (pre "indented code block\nwith two lines") (h2 "Quote") (blockquote "A blockquote line with " (strong "bold") " and a " (a (@ (href "https://example.com")) "link") ". Second quoted line continuing the same quote block.") (h2 "Table") (table (thead (tr (th "Feature") (th (@ (style "text-align: center")) "Native") (th (@ (style "text-align: right")) "Wasm") (th "Notes"))) (tbody (tr (td "Headings") (td (@ (style "text-align: center")) "fast") (td (@ (style "text-align: right")) "ok") (td "cheap PEG match per line")) (tr (td "Inline code") (td (@ (style "text-align: center")) "medium") (td (@ (style "text-align: right")) "slow") (td "per-char lookahead in grammar")) (tr (td "Tables") (td (@ (style "text-align: center")) "medium") (td (@ (style "text-align: right")) "slow") (td "many " (code "parse-inline") " calls")) (tr (td "Paragraphs") (td (@ (style "text-align: center")) "slow") (td (@ (style "text-align: right")) "slow") (td "long joined text runs")))) (h2 "Horizontal rule") (hr) (h2 "Closing") (p "A final paragraph with a trailing " (a (@ (href "https://example.com")) "reference link") " and some " (code "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."))