glypst
A type-safe Gleam library for generating Typst documents. Inspired by Lustre, glypst lets you build Typst documents using typed Gleam functions with attributes and content — just like Typst’s own function model.
Installation
gleam add glypst
Usage
import gleam/io
import glypst
import glypst/model
import glypst/text
pub fn main() {
glypst.Sequence([
model.heading([model.level(1)], [text.text("My Document")]),
model.heading([model.level(2)], [text.text("Introduction")]),
model.strong([], [text.text("Welcome to glypst. ")]),
text.line_break(),
model.bullet_list([model.marker(model.TextMarker("--"))], [
text.text("Type safe"),
model.strong([], [text.text("Fast")]),
model.emph([], [text.text("Easy to use")]),
]),
])
|> glypst.render()
|> io.println()
}
Which outputs valid Typst markup:
#heading(level: 1)[My Document]
#heading(level: 2)[Introduction]
#strong[Welcome to glypst. ]
#list(marker: [--])[Type safe][#strong[Fast]][#emph[Easy to use]]
Development
gleam test # Run the tests
gleam docs build # Build the documentation