Template engines
A template's body-file extension selects its engine. When a directory holds more than one candidate body file, the engine is chosen in a fixed priority order — the first match wins:
| Priority | Engine | Body file | Notes |
|---|---|---|---|
| 1 (highest) | Mustache | template.mustache | Logic-light, safest, simplest. |
| 2 | Handlebars | template.handlebars | Helpers + partials; the recommended default. |
| 3 | Go html/template | template.tmpl | Full control flow, context-aware auto-escaping. |
| 4 (lowest) | Static HTML | template.html | Served verbatim; dynamism via client-side JS. |
Two directory types are loaded outside this order (a directory is one of these or a body engine, never both):
- Raw PDF — a
raw.pdfreturned as-is; a building block for compositions. - Remote HTTP — a
template.http.hbswhose fetched response body becomes the output.
See Template structure for how these fit into a template directory.