typst-web-template/lib/html_utils.typ
Jean-Marie 'Histausse' Mineau 49f457cda7
add theme picker
2026-03-16 02:13:11 +01:00

16 lines
415 B
Typst

#let css-list = state("css-list", ())
/// Add string `css` to `css-list` if not already present
#let add-css(css) = context {
css-list.update(x => if css in x { x } else { x + (css,) })
}
/// Concatenate all css found in css-list at the end of the document
#let get-css() = context {
css-list.final().join("\n\n")
}
#let html_show(body) = {
show raw.where(lang: "raw-css"): it => add-css(it.text)
body
}