htyp/preamble.typ
Dzuchun 7856fe5162 Initial version
- equation dual-rendering (SVG+MathML)
- compile script
- readme instructions
- typst manifest
2026-06-20 10:45:04 +01:00

21 lines
648 B
Typst

#context {
if target() == "html" {
html.elem("style")[
.math-dual { display: inline-block; position: relative; }
.math-dual [aria-hidden] { display: contents; }
.math-dual svg { display: block; }
.math-dual math { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
]
}
}
#show math.equation: it => {
if target() == "html" {
html.elem("div", attrs: (class: "math-dual"))[
#html.elem("div", attrs: ("aria-hidden": "true", style: "display: contents"))[#html.frame(it)]
#it
]
} else {
it
}
}