Math Plugin
The Math plugin adds native LaTeX and KaTeX support to your docmd sites.
It utilizes markdown-it-texmath as securely integrated with the katex computation engine to render both inline and block-level mathematical equations smoothly without requiring complex client-side javascript libraries.
Setup
docmd add math
plugins: {
math: {}
}
How It Works
- Enable the plugin via your
docmd.config.js. - Wrap your standard LaTeX mathematics in
$(inline) or$$(block) indicators. - The server intelligently processes these math rules during the static-site build exactly as raw static HTML tags.
- Minimal injected CSS automatically scopes these classes directly, yielding immediate visualization the moment the user views the page!
Usage
Inline Mathematics
You can inject standard equations flawlessly within a paragraph utilizing 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, leverage double dollar signs $$ for block level formatting:
$$
\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}
$$