Repository navigation
v267.2.0 — Typst rendering with free-flow toggle
Adds Typst as a first-class rendering target alongside D2, Mermaid, and LaTeX.
Typst documents and fenced blocks are compiled server-side to SVG by shelling
out to the typst binary — matching the existing D2 model (no heavy in-process
crate, no client-side WASM). Pages are left white even in dark themes, since
Typst's paged model assumes paper. The typst binary is optional: if it is not
on PATH, a startup warning is printed and every Typst block or .typ file
degrades gracefully to an escaped source listing.
Added
- Typst fenced-block engine (
--with-typst).```typstblocks inside
.md/.htmlare rendered to SVG server-side viatypst compile - - --format svg(stdin → stdout) and inlined astypst-doc-pagecontainers. This
mirrors--with-d2exactly: one compile per block, unique SVGs inlined into
the stored HTML, no client JS, no render delay. - Standalone
.typfile tracking (--include-typst). Directory mode can now
track.typfiles alongside markdown and HTML. Each file is compiled through a
temp directory using apage-{0p}-of-{t}.svgtemplate, so multi-page
documents render as a stack of.typst-doc-pageSVGs separated by
.typst-page-breakrules. Independent of--with-typst:.typrendering is
gated by file extension, not by the block-engine flag. - Free-flow layout toggle. On Typst-format source pages, a layout button
(📄 paged / 📜 free-flow) appears as the leftmost control, to the left of the
zoom slider. Paged is the default (stacked white pages). Free-flow re-compiles
the document with#set page(height: auto, fill: none), recolours every glyph
from the baked#000000tocurrentColor, and renders a single transparent
sheet that adopts the theme text colour and reflows to the content column.
Both renderings are pre-computed server-side; the toggle switches between the
two in-memory blobs with no extra compile. The choice persists across
navigations vialocalStorage.
Changed
- Optional-binary pattern extended.
typst_available()mirrors
d2_available()(OnceLock-cachedtypst --versioncheck), and
serve_markdownprints the same startup warning shape when Typst is requested
but missing. tempfilepromoted from a dev-dependency to a runtime dependency, since
render_typst_document/render_typst_document_freeflowspin up a temp
directory for multi-page compilation.