Typst.Markup
Typst’s markup layer as typed combinators: headings, emphasis, lists, figures, tables, links, labels and references.
Everything here produces or consumes the root module’s Doc and Expr types and escapes through the same two doors; where Typst has both a markup shorthand and a function form, the function form wins, because it composes without whitespace sensitivity.
fn main() =
println(document([
heading(1, "Results"),
bullet_list(["one", "two"]),
link("https://example.org", "the source"),
]))
#heading(level: 1)[Results]
#list([one], [two])
#link("https://example.org")[the source]
Functions and Values
heading
heading : (Int, String) -> Typst.Doc
A numbered heading, #heading(level: n)[...].
emph
emph : (String) -> Typst.Doc
Emphasized prose, #emph[...].
strong
strong : (String) -> Typst.Doc
Strong prose, #strong[...].
bullet_list
bullet_list : (List(String)) -> Typst.Doc
An unnumbered list, one content argument per item.
numbered_list
numbered_list : (List(String)) -> Typst.Doc
A numbered list, one content argument per item.
link
link : (String, String) -> Typst.Doc
A link with display text, #link(url)[text].
figure
figure : (Typst.Expr, String) -> Typst.Doc
A figure around a body expression, with an escaped caption.
table
table : (Int, List(String)) -> Typst.Doc
A table with a fixed column count; cells are escaped prose.
label_mark
label_mark : (String) -> Typst.Doc
Attach a label to reference later, <name>.
ref_mark
ref_mark : (String) -> Typst.Doc
A reference to a labeled element, @name.