Expand description
Markdown → Typst conversion, driven by pulldown-cmark.
Policy documents are arbitrary prose: they contain $, @, #, tables,
and other characters that are syntactically meaningful in Typst markup. So
we don’t pass markdown through as Typst — we parse it into events and emit
Typst, escaping every text run. Headings become = so Typst’s native
outline() builds the table of contents and PDF bookmarks; emphasis,
lists, code, blockquotes, links, rules, and tables map to their Typst forms.
Block separation is explicit: every block element (heading, list, table,
blockquote, code block) is preceded by a blank line so Typst never folds a
list into the paragraph above it. The WISP also uses **Bold** lines as
ad-hoc sub-headings; a paragraph that is nothing but one bold run is
promoted to a real (level-4) heading so it gains weight and spacing instead
of bleeding into the following list.
Functions§
- section_
slug - Stable Typst label for a section, derived from its file name: the stem,
lowercased with every non-alphanumeric run collapsed to a single
-, under awisp-namespace (e.g.access-control-policy.md→wisp-access-control-policy). May collide for unusual names;section_slugsdisambiguates. - section_
slugs - Per-section unique Typst labels, one per entry in
sections, in order. Derived fromsection_slugwith collisions resolved by a-2,-3, … suffix so two files that normalise to the same base slug still get distinct, non-conflicting labels. Deterministic for a given orderedsections, so the anchor side (assembly) and the link side (conversion) agree. - to_
typst - Convert a markdown document to Typst markup.