[ANN] DocumenterTypst.jl - Fast PDF Generation for Documenter.jl via Typst


TL;DR: A new Documenter.jl backend that generates professional PDFs 10x faster than LaTeX, with zero setup required.


Two years ago, I shared an early experiment with using Typst as a backend for Documenter.jl. Today, I’m excited to announce that DocumenterTypst.jl v0.1 is ready for production use!

:rocket: Speed Comparison

Building the complete Julia documentation (2000+ pages, see here):

  • Typst backend (2 years ago): ~13 minutes (on Intel i9-9900K)
  • DocumenterTypst.jl today: < 60 seconds (on Apple M4 Max)
┌ Info: TypstWriter: AST conversion completed.
└ time = "0.97s"
[ Info: TypstWriter: compiling Typst to PDF (Typst_jll)...
┌ Info: TypstWriter: Typst compilation completed.
└ time = "47.06s"
┌ Info: TypstWriter: optimizing PDF with pdfcpu...
└ size_before = "61.28 MB"
┌ Info: TypstWriter: PDF optimization completed.
│ size_after = "21.12 MB"
│ reduction = "65.5%"
└ time = "5.82s"

Want to try it yourself? Check out our step-by-step guide for building the Julia documentation with the Typst backend. It’s as simple as:


julia scripts/build_julia_docs.jl

:sparkles: What’s New Since the Prototype

The package is now feature-complete and ready for production:

:white_check_mark: Full Markdown support: All Documenter features work out of the box

  • Code blocks with syntax highlighting (Julia fully supported!)
  • Tables, images, cross-references
  • Admonitions, footnotes, block quotes
  • Nested lists and complex layouts
  • NEW: Pure Typst files (.typ) can be mixed with Markdown sources

:white_check_mark: Math rendering: Two options for maximum compatibility

  • LaTeX math via mitex (backward compatible)
  • Native Typst math syntax (for new projects)

:white_check_mark: Zero setup required: Uses Typst_jll for automatic installation

  • No LaTeX distribution needed
  • Works on Windows, macOS, and Linux
  • Perfect for CI/CD pipelines

:white_check_mark: Optimized output: Automatic PDF compression

  • NEW: Built-in PDF optimization using pdfcpu (65%+ size reduction for large docs)
  • System font control to avoid emoji font bloat
  • Detailed timing for performance monitoring

:white_check_mark: Customizable styling: Easy template system

  • Override colors, fonts, and layouts
  • Create custom title pages
  • See styling guide

:package: Installation & Usage

Note: DocumenterTypst.jl is not yet registered in the General Julia Registry. Install from source:


using Pkg
Pkg.add(url="https://github.com/lucifer1004/DocumenterTypst.jl")


using Documenter
using DocumenterTypst
makedocs(
  sitename = "MyPackage",
  authors = "Your Name",
  format = DocumenterTypst.Typst(), # That's it!
  pages = [
    "Home" => "index.md",
    "Guide" => "guide.md",
  ]
)

:bullseye: Why Typst?

Compared to LaTeX:

  • Faster: Compilation in seconds, not minutes
  • Simpler: No TeX distribution installation
  • Modern: Clean syntax, better error messages
  • Reliable: Reproducible builds with Typst_jll

:books: Resources

:folded_hands: Acknowledgments

Built on top of Documenter.jl and powered by Typst. LaTeX math rendering via mitex.

Special thanks to the Documenter.jl team for their excellent plugin architecture, and the Typst team for creating such a fast and reliable typesetting system.

:crystal_ball: Future Plans

  • Julia General Registry registration (coming soon!)
  • Template gallery with pre-made styles
  • Additional Typst-native features
  • Performance optimizations for very large documents
  • Your suggestions!

Try it out and let me know what you think! Bug reports, feature requests, and contributions are all welcome at GitHub - lucifer1004/DocumenterTypst.jl


26 Likes

Hi,

do you mind to share an example of the typst based Julia manual?

I already pasted the Google Drive url in the original post.

1 Like

I’ve missed that.

You should note the huge size difference. Your example is 100MB, whereas the original Julia docs pdf is ~8MB.

A possible cause is that I did not do label hashing in this version to ensure no coliision. I would do another experiment to check the effect on the final file size.

Key issue seems to be embedded fonts.

  • Original: 100 M
  • System font disabled: 60 M
  • Codly disabled (using default codeblock rendering instead of the fancier one): 40 M
  • pdfcpu postprocessing (very fast, ~2s): 15 M
1 Like

As of 2025-12-28, this doesn’t appear to have made it to the registry, even after Pkg.Registry.update(). Will definitely check back in a few.

1 Like

Ah, yes, sorry for not mentioning this.

The PR New package: DocumenterTypst v0.1.0 by JuliaRegistrator · Pull Request #145159 · JuliaRegistries/General · GitHub has not been auto-merged yet.

1 Like