Living Document Notice
Published 2026-09-17. The evolving architecture, revisions, and connected notes for this dispatch live in the Stax Digital Garden.
Fast CLI Layout Compilation From CommonMark to PDF in Sub-100ms
Traditional print compilation stacks like LaTeX, Typst, or headless Chromium engines impose substantial invocation penalties. Waiting four to ten seconds to compile a single page sheet destroys iterative typographical refinement. Bosun Press implements a native Rust layout engine that compiles Markdown directly into PostScript and PDF in sub-100ms sweeps.
Zero-Browser Architecture
Rather than executing a multi-hundred-megabyte web browser runtime, the Press engine renders layout directly using low-level typography primitives:
[Markdown Source]
│
(Tree-sitter)
▼
[Marlinspike CST]
│
(HarfBuzz Glyph Layout)
▼
[Direct PDF Vector Stream]
By streaming vector commands directly to a file buffer without intermediate HTML or CSS serialization, compilation finishes in milliseconds:
pub fn compile_sheet_to_pdf(tokens: &[LayoutToken], output: &mut dyn Write) -> io::Result<()> {
writeln!(output, "%PDF-1.4")?;
// Stream content objects directly
for token in tokens {
match token {
LayoutToken::GlyphRun(run) => run.write_pdf_stream(output)?,
LayoutToken::LineSegment(line) => line.write_pdf_stream(output)?,
}
}
writeln!(output, "%%EOF")?;
Ok(())
}Compilation Benchmark Comparison
Benchmarking single-page A4 reference sheet generation on AMD Ryzen 9:
| Compiler Stack | Total Time | Memory Usage | Binary Dependency |
|---|---|---|---|
press-cli build | 74 ms | 18 MiB | Native binary |
| Typst CLI | 310 ms | 65 MiB | Rust binary |
| Pandoc + xelatex | 3,850 ms | 420 MiB | TeX Live distribution |
| Headless Chrome | 6,400 ms | 890 MiB | Chromium browser |
Sub-100ms compilation allows real-time previewing as words are typed in a terminal editor.
- Directus Target: press
- Garden Source Reference: MOC - Typography & Physical Print Specifications, MOC - Bosun PKM Tools
- Garden Source Reference: [PRS-1009 - Fast CLI Layout Compilation From CommonMark to PDF in Sub-100ms](PRS-1009 - Fast CLI Layout Compilation From CommonMark to PDF in Sub-100ms)