Bengal supports LaTeX-style mathematical expressions in Markdown. Enable thecontent.maththeme feature to render equations with KaTeX.
Syntax
Inline Math
Use single dollar signs for inline equations:
The equation $E = mc^2$ is famous. So is $\sum_{i=1}^n x_i$.
Block Math
Use double dollar signs on separate lines for display equations:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$
Role Syntax
Use the{math}role as an alternative:
The equation {math}`E = mc^2` is famous.
Enabling Math Rendering
Addcontent.math to your theme features in config/_default/theme.yaml:
theme:
features:
- content.math
This loads KaTeX (~200KB) for client-side rendering. Omit the feature if your site does not use math.
Escaping
- Use
\$for a literal dollar sign in prose - Inside code spans,
$is literal and not parsed as math