Skip to content

v267.2.0 — Typst rendering with free-flow toggle

Choose a tag to compare

@github-actions github-actions released this 23 Jul 06:08
· 18 commits to main since this release

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). ```typst blocks inside
    .md/.html are rendered to SVG server-side via typst compile - - --format svg (stdin → stdout) and inlined as typst-doc-page containers. This
    mirrors --with-d2 exactly: one compile per block, unique SVGs inlined into
    the stored HTML, no client JS, no render delay.
  • Standalone .typ file tracking (--include-typst). Directory mode can now
    track .typ files alongside markdown and HTML. Each file is compiled through a
    temp directory using a page-{0p}-of-{t}.svg template, so multi-page
    documents render as a stack of .typst-doc-page SVGs separated by
    .typst-page-break rules. Independent of --with-typst: .typ rendering 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 #000000 to currentColor, 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 via localStorage.

Changed

  • Optional-binary pattern extended. typst_available() mirrors
    d2_available() (OnceLock-cached typst --version check), and
    serve_markdown prints the same startup warning shape when Typst is requested
    but missing.
  • tempfile promoted from a dev-dependency to a runtime dependency, since
    render_typst_document / render_typst_document_freeflow spin up a temp
    directory for multi-page compilation.