Rendering
Docvia compiles Markdown into a RenderOutput tree. page.data.load() returns it as content, and the Renderer component renders it in your Svelte application.
Basic usage
<script>
import { Renderer } from "@docvia/core/svelte";
let { data } = $props();
</script>
<Renderer nodes={data.page.content} />
The Renderer is a Svelte 5 component using runes syntax. No client-side JavaScript is shipped unless your content contains interactive components.
Component registry
For interactive components embedded via directives, pass a registry:
<Renderer nodes={data.page.content} registry={registry} />
The registry resolves directive names to Svelte components. defineRegistry() in src/lib/registry.ts builds it from the components field in docvia.config.ts:
import { registry } from "#lib/registry.ts";
Renderer also switches tabbed code groups (fences with tab="...", :::code-group, or an npm fence) without extra setup.
Renderer props
| Prop | Type | Required | Description |
|---|---|---|---|
nodes | RenderOutput | RenderOutput[] | Yes | Compiled page content |
registry | ComponentRegistry | No | Component resolver for directives |
RenderOutput types
The compiled output is a tree of typed nodes:
| Kind | Description |
|---|---|
element | HTML element (div, p, h2, ...) |
text | Plain text content |
html | Raw HTML (syntax-highlighted code) |
component | Interactive component placeholder |
fragment | Grouping node with children |
Differences from React
The Svelte renderer does not yet support the components prop for tag-level overrides (e.g., replacing <a> or <img> globally). This is a React-specific feature. In Svelte, customize element rendering by extending the Renderer or by rewriting the output tree at build time with createSvelteRenderer({ transform }).