The Math plugin renders mathematical formulas in your Typemill content. You can write LaTeX-style math and display it beautifully with either KaTeX or MathJax.
The markdown syntax does not support math by default. Typemill implements the LaTeX and TeX syntax. Other CMS or tools for markdown might use a different syntax or might not support math at all.
You can write the syntax manually with the raw mode of the Typemill editor or you can use the visual mode, that wraps your math automatically.
- Write math formulas in the Typemill editor using a dedicated math block component.
- Support for display math and inline math.
- Choose between two rendering engines:
- KaTeX: Fast, locally integrated, no external requests.
- MathJax: Powerful, remotely loaded, supports a wide range of LaTeX features.
- Automatic Content Security Policy (CSP) whitelist for MathJax.
- Foundation for future PDF/EPUB/static export support via
onExportHtmlLoaded.
- Typemill v2.x or higher.
- PHP 8.1 or higher.
- Download the plugin.
- Unzip the content.
- Upload the folder
mathto your Typemill plugins directoryplugins. - The final path should be
your-typemill-installation/plugins/math.
- Log in to your Typemill administration dashboard.
- Go to System -> Plugins.
- Activate the Math plugin.
- Click on Settings for the Math plugin.
- Choose your tool:
- None: Math rendering is disabled.
- KaTeX: Uses the bundled KaTeX library for fast local rendering.
- MathJax: Loads MathJax from a CDN for extended LaTeX support.
- Save the settings.
Display math is rendered as a centered block. You can start a math block in the editor with the math component, or write the delimiters directly in your Markdown.
\[
E = mc^2
\]Inline math is rendered inside a paragraph. Both KaTeX and MathJax scan the page for inline delimiters.
Supported inline math syntax:
The energy is \( E = mc^2 \) in this frame.Static exports, PDFs, and EPUBs require math to be rendered as self-contained images because the client-side JavaScript engines are not available during export. The plugin code already listens to Typemill's onExportHtmlLoaded event and will, in a future version, replace browser-rendered formulas with cached SVG images when a remote render endpoint is configured.
Expected render endpoint contract:
POST /math
{
"math": "E = mc^2",
"display_mode": true,
"tool": "katex"
}Response: SVG string.
This plugin includes the following third-party libraries:
- Copyright (c) KaTeX contributors
- Licensed under the MIT License
- Website: https://katex.org
- Copyright (c) 2009–2025 The MathJax Consortium
- Licensed under the Apache License, Version 2.0
- Website: https://www.mathjax.org
- Added plugin documentation and changelog.
- Added
onExportHtmlLoadedevent handler withgenerateStaticAssetcaching for future PDF/EPUB/static export support. - Added render endpoint configuration (currently commented out; planned for a future release).
- Improved tool labels in the plugin settings: "KaTeX (fast, locally integrated)" and "MathJax (powerful, remotely loaded)".
- Bring back the icons in visual editor
- Switch to bracket syntax as standard instead of dollar sign
- Completely refactored for Typemill Version 2.