Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Excalidraw Math

An Obsidian plugin that renders LaTeX math formulas inside Excalidraw drawings.

Type $$...$$ (or $...$) into a text element and the plugin turns it into a crisp, scalable math image — right on the interactive canvas, fully movable like any other element, and included when you export the drawing to SVG/PNG.

Features

  • Inline & display math — $E = mc^2$ and $$\int_0^1 x^2\,dx$$.
  • Mixed text and math — Hydrogen ($$1e^-$$, $$1p^+$$) renders as a single line, text and formulas sharing one baseline.
  • Auto-render — write math in a text element, click away, and it renders automatically (within ~1 s).
  • Double-click to edit — double-click a rendered formula to turn it back into editable text; click away and it re-renders.
  • Dark mode aware — formulas follow Excalidraw's canvas theme automatically.
  • Self-healing — if a formula's image ever loses its file reference, it is rebuilt automatically.
  • Vector output — formulas are rendered as self-contained SVG via MathJax, so they stay sharp at any zoom and export cleanly.

Requirements

Installation

Manual

  1. Download main.js, manifest.json and styles.css (build them yourself — see below — or grab them from a release).
  2. Copy the three files into a new folder in your vault: <your-vault>/.obsidian/plugins/excalidraw-math/
  3. In Obsidian, open Settings → Community plugins, reload the plugin list, and enable Excalidraw Math.

Build from source

npm install
npm run build      # outputs main.js
# for development with auto-rebuild on save:
npm run dev

Usage

  1. In an Excalidraw drawing, add a text element.
  2. Type a formula using standard Obsidian math syntax:
    • Inline: $a^2 + b^2 = c^2$
    • Display: $$\frac{\mathrm{d}}{\mathrm{d}x} e^x = e^x$$
    • Mixed: Energy: $$E = mc^2$$
  3. Click somewhere else — the text is replaced by a rendered math image.
  4. To edit a formula again, double-click it. It becomes an editable text element; change it and click away to re-render.

You can also trigger rendering manually via the command palette: “Excalidraw Math: Render math in active Excalidraw”.

Settings

Setting Description
Auto-render Automatically render $$ text elements (polls the canvas).
Font size Base font size for rendered formulas.
Formula color CSS color for formulas, or auto to use a dark color that Excalidraw inverts in dark mode.

How it works

The plugin watches the active Excalidraw scene. When it finds a text element containing math, it renders the formula(s) to a self-contained SVG using MathJax (SVG output, vector glyphs — no font dependencies), and swaps the text element for an image element pointing at that SVG. The original source text is kept in the element's customData so it can be restored for editing.

Credits

Inspired by zsviczian/excalidraw-mathjax. Built on top of the excellent Obsidian Excalidraw plugin.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages