module
markdown
A small Markdown → virtual node renderer for content-heavy pages (markdown(source: post.body) in templates).
Supports ATX headings (with ids for linking), paragraphs, **strong**, *em*, code , links, images, bullet and numbered lists (nested by indentation), tables, block quotes, fenced code blocks (with language-* classes; Weft and Rust code is highlighted) and horizontal rules. Text is never parsed as HTML, so content is safe to render.
A component block renders a component, with the Markdown between its fences as its content (one paragraph is just its text):
::: Button(href: "/tickets", variant: "outline")
Book now
:::Its props are literal values only: no references, interpolation or handlers. An outer block's fence is longer than any inside it.
Functions
rust_segments
pub fn rust_segments(src: &str) -> Vec<(Option<&'static str>, String)>Rust split into highlighted pieces: keywords, types, strings, numbers, comments, macros and lifetimes, with Tailwind classes for a dark background. A light pass, not a parser: enough for docs.
slug
pub fn slug(text: &str) -> StringThe id a heading gets: its text in lower case, letters, digits and -/_ kept, spaces as - ("Pages & routes" → pages--routes).
template
pub fn template(src: &str) -> Vec<Node>A Markdown document as template nodes: parse's elements, and component blocks as those components.
weft_class
pub fn weft_class(kind: HighlightKind) -> Option<&'static str>Tailwind classes for highlighted Weft (on a dark background).