LaTeX with KaTeX
What this demonstrates
@quartz-community/latex with renderEngine: katex converts $...$ and $$...$$ into
KaTeX’s HTML + MathML output during the build. The browser receives finished markup and
a stylesheet; it does not download or run a math library, and it does not reflow the page
after load.
Configuration used
- source: "@quartz-community/latex"
enabled: true
options:
renderEngine: katex
order: 80Content used
Inline: the sandbox serves $n = 1$ site while the shared engine serves $n = 51$.
$$
T_\text{total} = \sum_{i=1}^{n} \left( t_\text{parse}^{(i)} + t_\text{render}^{(i)} \right)
$$
$$
\begin{aligned}
\text{isolation} &= \text{checkout} \times \text{node\_modules} \times \text{config} \\
&\quad \times \text{dist} \times \text{port}
\end{aligned}
$$Rendered result
Inline: the sandbox serves site while the shared engine serves .
A displayed sum, because build cost scales with page count and not with plugin count:
An aligned environment, to show that KaTeX’s multi-line environments survive the transform:
A fraction and a matrix, exercising nested groups:
What the rendered output proves
The emitted HTML contains class="katex" spans, a <math MathML subtree (KaTeX emits both
an accessible MathML copy and visually styled HTML), and katex-display wrappers for the
$$ blocks. Because all of that is in the static HTML, the math is present with JavaScript
disabled — the assertion for this page is the presence of katex and katex-display in the
DOM dump, not a screenshot.
safe_for_shared_engine
true — pages with no $ math are unaffected, and the only global cost is the KaTeX
stylesheet, which the engine already ships behind this plugin.