Math
TeX formulas rendered with KaTeX, inline and as display blocks.
Formulas are parsed from TeX syntax and rendered to HTML at compile time with KaTeX, so nothing runs in the browser. The output includes MathML for screen readers.
Import the stylesheet once next to the base styles. It ships the KaTeX fonts, so no extra package is needed.
import "pzzadocs/styles.css";
import "pzzadocs/math.css";Display math#
A block between two $$ lines renders centred in its own surface.
$$
\int_{0}^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
$$Long formulas scroll horizontally instead of wrapping.
Inline math#
Wrap a formula in $$ inside a sentence to keep it on the line, for example or the quadratic formula .
... for example $$E = mc^2$$ or the quadratic formula $$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$.Single-dollar spans such as $x$ are plain text by default, so prices like $5 and $10 never turn into formulas. Set math.singleDollar to true in the config to enable the shorter syntax.
export default defineConfig({
math: { singleDollar: true },
});Matrices and alignment#
Disabling#
Set math.enabled to false to skip the parser entirely. Dollar signs are then ordinary characters everywhere.
export default defineConfig({
math: { enabled: false },
});Behaviour#
- Code blocks and inline code are never parsed for math, so
$$inside a fence is left alone. - The Markdown and
llms.txtoutputs keep the TeX source, which assistants read natively. - Headings that contain math use the plain TeX text for their ids and the table of contents.