[!WARNING] Archived This project was here for the time that there was no better support for Typst inside Obisidian. As it uses the Typst CLI to render, it is highly inefficient. It has now been replaced with https://github.com/azyarashi/obsidian-typst-mate
An Obsidian plugin that replaces default math blocks with Typst-rendered math blocks using the Typst CLI.
This version adds three major features:
- 🔴 Live Preview Support - Math now renders in Live Preview mode, not just Reading mode!
- ⚡ Watch Mode - Code blocks auto-recompile when you edit them (experimental)
- 💬 Better Error Messages - Clean, user-friendly error display instead of ugly boxes
See RELEASE_v1.3.0.md for full details or QUICKSTART_v1.3.0.md for a quick guide.
This plugin uses a MathJax override approach to intercept all math rendering at the source, making it 100% reliable with no timing issues. Inspired by obsidian-wypst but uses the latest Typst CLI instead of outdated WASM.
Key Benefits:
- ✅ Catches all inline
$...$and block$$...$$math - ✅ Works in both Reading AND Live Preview modes
- ✅ No race conditions or timing issues
- ✅ Uses latest Typst CLI with full HTML feature support
See MATHJAX_OVERRIDE.md for technical details.
- ✨ Render math equations using Typst's powerful typesetting engine
- 🔄 Automatic compilation of Typst code blocks
- 🎨 Beautiful, publication-quality math rendering
- 💱 NEW: Replaces native Obsidian math syntax (
$...$ and$$...$$ ) with Typst - 🎭 NEW: Automatic theme color matching (dark/light mode support)
- ⚙️ Configurable Typst CLI path
- 💾 Caching for improved performance
- Install Typst CLI from https://github.com/typst/typst
- Follow the installation instructions for your platform
- Make sure
typstcommand is available in your PATH
- Clone this repository or download the release
- Copy the folder to your vault's
.obsidian/plugins/directory - Reload Obsidian
- Enable the plugin in Settings → Community Plugins
- Clone this repository
- Run
npm installto install dependencies - Run
npm run buildto compile the plugin - Copy
main.js,manifest.json, andstyles.cssto your vault's plugins folder
Create a code block with math or typst language identifier:
```math $ sum_(i=1)^n i = (n(n+1))/2 $ ```
```typst $ integral_0^oo e^(-x^2) dif x = sqrt(pi)/2 $ ```
NEW: The plugin can also replace Obsidian's native math rendering!
Inline math:
This is an equation $x^2 + y^2 = z^2$ in the text.
Block math:
$$
\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
The plugin will automatically convert LaTeX syntax to Typst and render it with Typst's engine. Enable this in settings!
You can use any Typst syntax inside the code blocks:
```math $ mat( 1, 2, 3; 4, 5, 6; 7, 8, 9 ) $ ```
```typst $ lim_(n -> oo) (1 + 1/n)^n = e $ ```
Go to Settings → Typst Math Renderer to configure:
-
Typst CLI Path: Path to your Typst executable (default:
typst) -
Enable Inline Math: Process inline math blocks (
$...$ ) - NEW! -
Enable Display Math: Process display math blocks (
$$...$$ ) - NEW! - Debug Mode: Enable debug logging in the console
Note: When inline/display math are enabled, the plugin will replace Obsidian's native math rendering with Typst rendering. LaTeX syntax is automatically converted to Typst syntax.
npm install
npm run dev # Development mode with watch
npm run build # Production build.
├── main.ts # Main plugin code
├── manifest.json # Plugin manifest
├── package.json # NPM dependencies
├── tsconfig.json # TypeScript configuration
├── esbuild.config.mjs # Build configuration
├── styles.css # Plugin styles
└── versions.json # Version compatibility
If you see "Typst CLI not found" error:
- Ensure Typst is installed:
typst --version - Add Typst to your PATH
- Or specify the full path in plugin settings
- Check the debug mode in settings to see detailed logs
- Verify your Typst syntax is correct
- Try compiling the same code with Typst CLI directly
- Desktop only (requires Node.js child_process)
- Requires Typst CLI to be installed separately
- HTML output format is experimental in Typst
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT
If you encounter any issues or have suggestions, please file an issue on GitHub.