docs / Language
Markdown
The built-in <Md> component and renderMarkdown(): tokenizer-based, with highlighting, GFM, streaming, and configurable HTML policies.
Vesk includes a built-in `<Md>` component and `renderMarkdown()` function for rendering Markdown. The implementation is tokenizer-based (no regex) and supports syntax highlighting, GFM, and configurable HTML policies.
app/components/Docs.vsk
<Md content="# Hello\n\nThis is **bold**." />
Content types
| Type | Behavior |
|---|---|
| string | Literal markdown, rendered synchronously |
| Tracked<string> | Reactive — re-renders when the cell changes |
| Resource<string> / useFetch.stream | Streaming — progressively renders chunks |
| "/path/to/*.md" | Runtime-loaded from the public/ directory |
Props and options
| Option | Description |
|---|---|
| css | Built-in styles: true / false / custom CSS string |
| lineNumbers / copy / highlight | Code-block presentation (line numbers, copy button, highlighted lines) |
| hardBreaks | Treat newlines as <br> |
| html | 'escape' (default) | 'allow' | 'allowlist' — inline HTML policy |
| renderMarkdown(content, opts) | Imperative render: chrome, ids, autolink, allowTags |
| configureMd({ ... }) | Global defaults, e.g. { html: 'allowlist', allowTags: ['br', 'strong'] } |
`<Md>` content is polymorphic: a string renders synchronously, a Tracked<string> re-renders when the cell changes, a Resource/useFetch.stream progressively renders chunks, and a "/path/to/*.md" string loads from public/ at runtime.