40 lines
935 B
Typst
40 lines
935 B
Typst
#let callout(kind: str, label: str, body) = context if target() == "html" {
|
|
html.section(class: kind + " callout", context {
|
|
let depth = counter(heading).at(here()).len() + 1
|
|
heading(
|
|
depth: depth,
|
|
outlined: false,
|
|
numbering: none,
|
|
label,
|
|
)
|
|
" "
|
|
body
|
|
})
|
|
} else {
|
|
let col = (
|
|
note: color.rgb("#0000cd"),
|
|
warn: color.rgb("#a52a2a"),
|
|
tip: color.rgb("#228b22"),
|
|
todo: color.rgb("#ff0000"),
|
|
).at(kind)
|
|
block(
|
|
fill: col.transparentize(85%),
|
|
stroke: (y: col),
|
|
width: 100%,
|
|
outset: (x: 1em, y: 0.5em),
|
|
spacing: par.spacing + 0.5em,
|
|
inset: (y: 0.5em),
|
|
{
|
|
set text(fill: col)
|
|
strong(label)
|
|
body
|
|
},
|
|
)
|
|
}
|
|
|
|
|
|
}#let note = callout.with(kind: "note", label: "Note:")
|
|
#let warn = callout.with(kind: "warn", label: "Warning:")
|
|
#let tip = callout.with(kind: "tip", label: "Tip:")
|
|
#let todo = callout.with(kind: "todo", label: "TODO:")
|