Overview
What typstgen does, where it stops, and how this documentation is organised.
typstgen compiles an existing .typ file to PDF. The Typst engine runs inside typstgen as a Rust
library, so no typst binary has to be installed and no subprocess is started. Where imported
templates live is set in a config file, typstgen.toml, instead of being hardcoded.
One crate, three entry points:
- CLI:
typstgen compile input.typ(defaultclifeature). - Rust library:
typstgen::compile(path, &config)returns the PDF bytes. - Wasm: the
wasmfeature exportscompile, which takes the source and its imports as a JSON virtual filesystem.
Where it stops
| typstgen does | typstgen does not |
|---|---|
Compile one .typ file to one PDF |
Watch files or compile folders in bulk |
| Resolve imports against configured template directories | Download Typst packages (@preview/…) |
| Bundle Typst’s fallback fonts, optionally add system and custom fonts | Manage clients, numbering or data (that was docgen) |
| Report Typst errors and warnings with file, line and column | Export PNG, SVG or HTML |
Pass sys.inputs, enforce PDF/A or PDF/UA, export page ranges |
Set the PDF identifier or /Creator |
How the docs are organised
- Getting started: install the CLI or the crate and compile a first document.
- Guides: how templates and imports are resolved, which fonts are available, and how to pass inputs and PDF options.
- Reference: CLI options,
typstgen.tomland the Rust and Wasm API. Item-level documentation lives on docs.rs.
Every PDF in the showcase was compiled by typstgen from the .typ file shown next to
it.