toml
Reads structured data from a TOML file.
The file must contain a valid TOML table. TOML tables will be converted into Typst dictionaries, and TOML arrays will be converted into Typst arrays. Strings, booleans and datetimes will be converted into the Typst equivalents and numbers will be converted to floats or integers depending on whether they are whole numbers.
The TOML file in the example consists of a table with the keys title
, version
, and authors
.
Example
#let details = toml("details.toml")
Title: #details.title \
Version: #details.version \
Authors: #(details.authors
.join(", ", last: " and "))

Parameters
source
A path to a TOML file or raw TOML bytes.
Definitions
decode
toml.decode
is deprecated, directly pass bytes to toml
instead
Reads structured data from a TOML string/bytes.
data
TOML data.
encode
Encodes structured data into a TOML string.
value
anyRequiredPositional
any
RequiredPositionalValue to be encoded.
pretty
Whether to pretty-print the resulting TOML.
Default: true