Math Plugin
The Math plugin adds native LaTeX and KaTeX support to your docmd sites.
It uses markdown-it-texmath integrated with the katex computation engine. This renders inline and block-level equations smoothly without complex client-side javascript libraries.
Configuration
The Math plugin is an optional plugin. Install it via the CLI:
npx @docmd/core add math
Enable it in your docmd.config.json:
Example
{
"plugins": {
"math": {}
}
}
How It Works
- Enable the plugin via your
docmd.config.json. - Wrap your standard LaTeX mathematics in
$(inline) or$$(block) indicators. - The engine processes these rules during the build exactly as raw static HTML tags.
- Minimal injected CSS styles the classes automatically. This yields immediate visualisation on page load.
Usage
Inline Mathematics
Inject standard equations within a paragraph using single dollar signs $:
Here is an inline equation: $E = mc^2$
Here is an inline equation:
Block Mathematics
For wider mathematical proofs or distinct formulations, use double dollar signs $$ for block level formatting:
$$
\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}
$$