What is the "Typst-way" mental model around templates with shared logic and defaults?

Well, mostly yes, but if you want, you can add the font and margin parameters to the template() and just use one global show rule. But also this:

#let colorize(body, color: red) = text(color, body)

#let colorbox(body, color: red) = box(fill: color, body)

I think I remember that in some rare cases set text(color) would work better, but if you just apply this directly on a normal text, then you can use a shorter version.


Not sure what procedural means here, but the majority of set and show-set rules supposed to be in a template function, this is literally what it’s for, generally speaking.


Yes.


Well, the state thing, I guess, but that’s about it.