Guide
Configuration
Everything in <config> — page defaults, per-tag defaults, document metadata, and fonts (local files or Google fonts).
<config> sits at the top of a document and sets things up before any content.
Its children are all optional:
<page size= margin=>— defaults inherited by every<page>in<pages>. Sizes areA3,A4,A5,A6,Letter, orLegal(case-insensitive); a per-page attribute overrides the default for that page. Omitsizeand pages default to A4.margintakes the CSS 1–4 value shorthand —margin="0"(all sides),"20px 40px"(vertical / horizontal), or"10px 20px 30px 40px"(top / right / bottom / left); omit it and every edge gets 36pt (half an inch).<meta name= value=>— written into the PDF's Info dictionary (title,author, …). Both attributes are required; repeat the tag for as many pairs as you like.<defaults>— per-tag attribute defaults (see below).<font-face>/<google-font>— register custom font families (see Fonts below).<fonts subset=>— font subsetting is on by default (only the glyphs you use are embedded). Setsubset="false"to embed full faces.<diagnostics mode=>— how the engine treats errors.mode="warn"(the default) reports every recovered problem yet still produces a PDF;mode="strict"refuses to write output if any error was recorded (content dropped because it couldn't fit a page, a required attribute missing). Warnings never block in either mode. Usestrictin a build pipeline to fail the build on lost content.
Defaults
A <defaults> block declares the attribute values a tag should assume when an
instance leaves them out — <text font="merriweather" size="11"/> makes every
<text> default to that face and size. A block in <config> is document-wide,
but blocks also nest inside a page or any container and apply positionally, so an
attribute resolves element attribute → nearest enclosing <defaults> → config
defaults → system default. The Defaults guide covers the
full positional and scoping rules; style:* attributes are resolved separately
and aren't defaulted.
Fonts
The built-ins are sans (the default) and serif, embedded so output looks the
same everywhere — they're the metric-compatible Liberation faces (Arial- and
Georgia-metric), so a document falls back to a familiar shape on any platform.
Register more in two ways:
<font-face name= src= [bold] [italic] [serif]/>points a family at a local font file (.ttfor.woff2), resolved relative to the document. One declaration per face — repeat withbold/italicto add weights and styles to the samename. Reusing a built-inname(e.g.name="sans" bold) swaps just that one face.<google-font name= [serif]/>pulls a family straight from Google Fonts by its name — no local files. Its regular, bold, italic, and bold-italic faces are fetched automatically and the family is used (lowercased) viafont="…".serifhints the fallback for families with serifs. The CLI downloads and caches the faces to embed them; this browser preview loads them from the Google Fonts API.
<document version="2.0">
<config>
<page size="A6" margin="20px" />
<meta name="title" value="Fonts" />
<google-font name="Lobster" />
<google-font name="Roboto" />
<defaults>
<text font="roboto" size="13" />
</defaults>
</config>
<pages>
<page>
<vertical gap="8px">
<text font="lobster" size="30">Lobster heading</text>
<text>Roboto, size 13 — both inherited from <defaults>:
<b>bold</b>, <i>italic</i>, and <b><i>both</i></b> — no files to ship.</text>
<text font="serif" size="11">Built-in serif overrides the default.</text>
</vertical>
</page>
</pages>
</document>