Typst helper package

Every template imports @craftadoc/form. It reads the form values and renders them safely; nothing in it evaluates input as Typst code.

#import "@craftadoc/form:0.1.0": values, rich, icon, filled, date, paper-size

values(fallback)

Returns the values someone filled in. When you compile the template yourself, there are none, so it returns fallback, normally your sample values:

#let d = values(json("example.json"))

rich(value)

Renders a rich-text (markdown) field: paragraphs, bold, italic, links and lists. In example.json the value is a plain string: when you compile locally, rich shows it as plain paragraphs, without applying Markdown. Craftadoc converts the Markdown before it compiles.

#rich(d.about)

icon(value, ..args)

Renders an icon field's value, such as "brands:github" or "solid:phone". Extra arguments go to Typst's text:

#icon(d.icon, fill: blue, size: 12pt)

filled(value)

Whether an optional value was filled in: false for none, "" and empty lists.

#if filled(d.linkedin) [LinkedIn: #d.linkedin]

date(value)

Turns a date field ("2026-10-25") into a Typst datetime:

#date(d.issued).display("[day] [month repr:long] [year]")

paper-size(default)

The document size chosen in the form, for templates that list several sizes in craftadoc.json. When you compile the template yourself, it returns default, normally your first size. Typst knows most sizes as paper names:

#set page(paper: paper-size("a4"))

Visitors from the US, Canada and Latin America start on US Letter when the template offers it; everyone else starts on the first size. Make sure your layout works at every size you list: US Letter is 18 mm shorter than A4. The check compiles every size.

Images

Image fields arrive as file paths. Use them directly with Typst's image:

#box(clip: true, radius: 50%, image(d.photo, width: 3cm, height: 3cm, fit: "cover"))