docs: move config from design to template

This commit is contained in:
MultisampledNight 2024-01-10 21:22:29 +01:00
commit 221ca09961
No known key found for this signature in database
GPG key ID: C81EF9B053977241
2 changed files with 75 additions and 71 deletions

View file

@ -8,6 +8,49 @@
heading: (font: "Montserrat", weight: "regular"),
)
#let expand(it) = {
("("
+ upper(it.first())
+ "|"
+ it.first()
+ ")"
+ it.clusters().slice(1).join()
+ "s?")
}
#let singlify(it) = {
it = lower(it)
if it.ends-with("s") {
it = it.slice(0, -1)
}
it
}
#let terminate-recursion(it) = {
let clusters = it.text.clusters()
clusters.insert(1, "\u{FEFF}")
clusters.join()
}
// even though it looks like this could be automated with a `query`,
// this'd require wrapping the whole document in a show rule
// at which point `query` doesn't find anything anymore
#let terms = (
"source",
"AST",
"graph IR",
"runtime",
"optimizer",
"scheduler",
"VM",
"command",
"pipeline",
"input", "argument", "consumer",
"output", "streamer",
"modifier",
)
// yes, the shadowing is intentional
#let terms = regex(terms.map(expand).join("|"))
#let conf(
title: none,
subtitle: none,
@ -44,6 +87,20 @@
radius: 0.25em,
)
// highlight important terms in bold
show raw: it => {
// avoid making terms in codeblocks bold
show terms: terminate-recursion
it
}
show terms: strong
// color codeblocks
// haskell hl seems to work ok for this
show raw.where(lang: "iowo", block: true): it => {
raw(it.text, lang: "haskell", block: true)
}
// document title
if title != none {
align(
@ -56,6 +113,20 @@
v(0.25cm)
}
// outline and other prelude info
outline(
indent: auto,
fill: line(
length: 100%,
stroke: (
cap: "round",
join: "round",
thickness: 0.5pt,
paint: luma(75%),
),
),
)
// content itself
doc
}