Skip to main content

Module render_typst

Module render_typst 

Source
Expand description

Typst markup renderer.

Converts a SurfDoc block tree into valid Typst markup text. The output can be compiled by the Typst engine to produce PDF (or other formats).

Markdown content within blocks is converted to Typst markup via the md_to_typst helper. All user content is escaped to prevent Typst injection.

Structs§

ImageScope
RAII guard that clears the ambient image map when dropped.

Functions§

install_image_context
Install map (image src → resolvable virtual file path) as the ambient image context for the current thread for the lifetime of the returned guard. The PDF renderer installs this before to_typst after registering the mapped paths with the engine’s static file resolver.
md_to_typst
Convert a markdown string to Typst markup (block-level).
md_to_typst_inline
Convert inline markdown to Typst inline markup.
to_typst
Render a SurfDoc as a complete Typst document string.