华佳浩586 downloadsRender math with a bundled, up-to-date MathJax 4 engine, without replacing Obsidian's built-in MathJax.
An up-to-date MathJax 4 engine for Obsidian — bundled, fully isolated, PDF-safe.
Install like any community plugin — three files, no build steps, no other plugins required.
Obsidian ships its own MathJax build, and it lags behind upstream. New TeX packages, better font
handling and upstream bug fixes only arrive when Obsidian updates. This plugin bundles a current
MathJax 4 engine and renders math through it. By default it works side by side with the
built-in one — without ever touching window.MathJax or Obsidian's renderMath(). An
explicit invasive mode (off by default, enabled only after a confirmation dialog) goes
further and takes over Obsidian's native rendering entry points, so every surface — including
hover previews and embeds — upgrades to the bundled engine.
.tex file; edits hot-reload and
apply across every note.main.js, manifest.json and styles.css from the
latest release.<vault>/.obsidian/plugins/latest-mathjax/.Reading View takeover is on by default; Live Preview takeover and inline-math takeover are opt-in switches under Settings → Latest MathJax → Compatibility.
Macros can live in a versioned file instead of the settings text box:
| Source | Evaluated | Good for |
|---|---|---|
Preamble file (vault-relative path, e.g. math/macros.tex) |
first | shared, versioned definitions — diffable and backed up with the vault |
| Global preamble (settings text) | second | quick personal overrides (\renewcommand) |
Both surfaces plus PDF export use the merged definitions. Inline-only setups keep working exactly as before 0.2.0.
| Surface | Default mode | Invasive mode | Notes |
|---|---|---|---|
| Reading View | ✅ | ✅ | display + inline (inline opt-in in default mode) |
| Live Preview | ✅ | ✅ | public editor widgets (opt-in in default mode) |
| Popout windows | ✅ | ✅ | per-document stylesheet mirroring |
| PDF export | ✅ | ✅ | isolated SVG engine, deterministic output |
| Hover preview | ❌ | ✅ | invasive mode covers Obsidian's own popover path automatically |
| Embeds | ❌ | ✅ | same mechanism as hover preview |
| Canvas | ❌ | ❌ | no render hook in either mode |
Desktop only for now; a mobile acceptance pass is pending. See
docs/compatibility.md for details and
docs/accessibility.md for assistive-technology behavior.
On Obsidian 1.13+ the settings tab is searchable; 1.8–1.12 get the classic tab.
In the default (coexistence) mode:
window.MathJax is never deleted, replaced or patched.renderMath() / finishRenderMath() are never monkey-patched.Invasive mode deliberately overrides guarantee 1 and 2 for exactly two members
(MathJax.tex2chtml, MathJax.chtmlStylesheet), and only after you confirm the warning
dialog. Its contract:
tex2svg, version, …)
is touched, so other plugins depending on native MathJax keep working.When the bundled engine cannot render a formula, the configurable fallback shows Obsidian's own output, the raw LaTeX, or a compact error — the note is never left blank.
docs/STATUS.md — what's done, verification recordsdocs/ROADMAP.md — what's next, acceptance gatesdocs/architecture.md — how the pieces fitdocs/compatibility.md — surface-by-surface detaildocs/dev-plan.zh.md — original Chinese development plannpm install # install dependencies
npm run dev # watch build
npm run build # type-check + production build
npm test # automated unit/integration tests (vitest)
npm run check # complete local release gate (lint + tests + build + metadata)
To try it in a vault, copy main.js, manifest.json and styles.css into
<vault>/.obsidian/plugins/latest-mathjax/.
Releases are built by GitHub Actions from a plain SemVer tag (0.2.0, not v0.2.0) — never
upload generated assets manually. Prepare the version, update CHANGELOG.md, pass
npm run check, then:
npm version minor --no-git-tag-version # or patch
git add package.json package-lock.json manifest.json versions.json CHANGELOG.md
git commit -m "release: publish $(node -p "require('./package.json').version")"
git push origin main
git tag -a "0.2.0" -m "Latest MathJax 0.2.0"
git push origin "0.2.0"
The tag workflow verifies version consistency, runs the complete check, attests build
provenance, and publishes main.js, manifest.json and styles.css.
MIT — MathJax itself is Apache-2.0.