init Vorlage
This commit is contained in:
29
code-listing.typ
Normal file
29
code-listing.typ
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user