Files
Typst-Vorlage/code-listing.typ
2026-03-11 08:07:31 +01:00

29 lines
457 B
Typst

// code-listing.typ
#let code-listing(
body: str,
caption: none,
lang: "text",
label: none,
) = {
show raw: set text(size: 9pt)
let fig = figure(
block(
width: 100%,
inset: (x: 14pt, y: 12pt),
radius: 5pt,
stroke: 0.5pt,
raw(lang: lang, block: true, body.trim()),
),
supplement: "Listing",
kind: "code",
caption: caption
)
if label != none {
[#fig #label]
} else {
fig
}
}