dingzy53309 downloadsRender TikZ code blocks with your locally installed TeX distribution (TeX Live, MacTeX, MiKTeX) instead of a browser WASM engine. Full TikZ, real compiler logs, transparent caching.
Render ```tikz code blocks in Obsidian with your **locally installed TeX distribution** (TeX Live, MacTeX or MiKTeX) instead of a browser WASM engine. A rewrite of artisticat1/obsidian-tikzjax, see License.

dvisvgm installed:brew install --cask mactex-no-gui)sudo apt install texlive-latex-extra texlive-luatex texlive-pictures dvisvgmsudo dnf install texlive-scheme-medium dvisvgmsudo pacman -S texlive-basic texlive-latexextra texlive-pictures dvisvgmmd.obsidian.Obsidian), the plugin automatically executes host TeX binaries via flatpak-spawn --host and uses ~/.cache/obsidian-tikz for scratch files without extra setup.From the community directory (recommended)
You can also open the plugin's page: community.obsidian.md/plugins/tikz.
Manually
main.js, manifest.json and styles.css from the latest release.<vault>/.obsidian/plugins/.tikz there and put the three files in it.Beta versions: install BRAT and add dingzy53/obsidian-tikz.
Update or remove: select Check for updates or Uninstall in Settings → Community plugins.
Place TikZ code inside a ```tikz block. Standard figures, bare snippets, or complete documents are all supported:
```tikz
\begin{document}
\begin{tikzpicture}
\draw[thick, ->] (0,0) -- (1,1) node[right] {$x$};
\end{tikzpicture}
\end{document}
```
Bare TikZ snippets and packages loaded inline are also accepted:
```tikz
\usepackage{forest}
\begin{forest}
[VP [NP [Det][N]] [V]]
\end{forest}
```
\usepackage, \usetikzlibrary and \DeclareMathOperator lines in a bare snippet are moved into the preamble, including ones written over several lines.
A block shows exactly one page. A document that produces several, such as two tikzpictures under \documentclass[tikz]{standalone}, fails with an error saying so. dvisvgm would otherwise show page 1 and silently drop the rest. Put each picture in its own block, or combine them in one tikzpicture (for example with shift on a scope).
The error block shows TeX's (or dvisvgm's) first error line, the full compiler log and the generated LaTeX. For the common mistakes it adds a hint naming the fix:
\lt / \gt copied from note math (MathJax only; write < / >);right=of, diamond, fit, Stealth, …), with the \usetikzlibrary to add;\color inside font=, which dvisvgm cannot nest.Click a diagram, or select it with Tab and press Enter, to open it in a viewer. It opens fitted to the window, and you can:
+ / - to zoom, 0 to fit, 1 for actual size, and Esc to close.The viewer uses the already rendered SVG, so nothing is recompiled. Turn it off with Click to enlarge diagrams.
Phones and tablets cannot run TeX, so on mobile the plugin only displays diagrams that a desktop rendered and shared. Sharing is off by default, because it adds visible files to your vault.
TikZ cache by default) and fills it with one <hash>.svg per diagram in your notes, copying renders it already has.<64 hex>.svg are ever deleted, so anything else you keep in the folder is safe..svg counts as an image). Turn on Installed community plugin list to sync the plugin itself and its settings, so the phone uses the same shared folder.manifest.json, main.js, styles.css and data.json. A hidden cache, including the plugin's own cache/, would never reach your phone. You can still add the shared folder to Settings → Files and links → Excluded files to keep it out of search and the graph.<hash>.svg) are saved in <vault>/.obsidian/plugins/tikz/cache/ (hidden inside the plugin directory; zero vault pollution). Failed compiles are not cached; the error block shows the live compiler log. Very deeply nested output (pgfplots surf nests a group per facet, thousands deep, which took seconds to process on every display) is flattened when displayed, without changing how it looks. When the entry limit is reached, the least recently used diagrams are dropped first..tex, .dvi, .log) live in your OS temp folder (os.tmpdir()/obsidian-tikz/, or ~/.cache/obsidian-tikz/ on Flatpak) and are cleaned up immediately upon completion.Diagrams rendered side-by-side in Light mode (left) and Dark mode (right) with automatic adaptive contrast:



A diagram shared from desktop, shown on a phone: in the note, in the viewer, and pinch-zoomed to 203%.

| Setting | Description | Default |
|---|---|---|
| Dark mode colors | Adaptive (mirrors lightness with contrast floor), Light canvas (light panel), or Off. |
Adaptive |
| Click to enlarge diagrams | Clicking a diagram (or Enter on it) opens the zoomable viewer. | true |
| Share diagrams with mobile | Desktop: keep an SVG of every diagram in the shared folder so a phone can show it. Adds visible files to the vault. | false |
| Shared folder | Vault folder for shared diagrams; must be visible and outside the config folder. Use the same one on every device. | TikZ cache |
| TeX engine | dvilualatex (recommended), latex, xelatex, or pdflatex. |
dvilualatex |
| Binary paths | Custom path overrides for TeX engine and dvisvgm, with an Auto-detect button. |
Auto (PATH) |
| Extra PATH | Extra directories to append to PATH at runtime. |
Empty |
| Default preamble | Common packages injected when no \documentclass is provided. |
TikZ, common libraries, AMS math |
| Heavy packages | When pgfplots, tikz-cd, circuitikz, chemfig and tikz-3dplot load: only for diagrams that use them, or always. | When a diagram uses them |
| Allow shell escape | Enables -shell-escape (danger: executes arbitrary system commands). |
false |
| Compile timeout | Maximum seconds per compilation stage (1–3600) before killing the process tree. Time spent queued does not count. | 20 |
| Parallel compiles | How many diagrams compile at once; the rest queue. 0 = automatic (half the CPU cores, 1–4). |
0 |
| Maximum cache | Maximum cached SVGs (0 = unlimited). A saved 500 (the default before 1.3) moves to the new default once. |
2000 |
[!NOTE] On macOS, GUI apps launched from Finder or the Dock do not inherit your shell's
PATH. If binaries show as "not found", click Detect automatically or set the path manually (e.g./Library/TeX/texbin).
blue!12 is 12% blue): they are rebuilt with the same color mixed into the dark page instead. White becomes the page color, and pastel panels become faint tints just above it, never darker than the page.ball color, or colormaps).The theme comes from Obsidian, unless a container outside the note overrides it. The nearest data-tikz-theme="light" or "dark" ancestor wins, then the nearest .theme-light or .theme-dark ancestor. This is for other plugins and outer containers, for example printing diagrams in light colors while Obsidian is dark. Wrapping a ```tikz block in <div data-tikz-theme="light">…</div> in Markdown does not work: Obsidian renders the HTML <div> and the code block as siblings rather than nesting them.
In Adaptive mode, explicit white fills (such as fill=white on a label mask, a legend box or a Venn cutout) become the dark page color (#1e1e1e, Obsidian's default dark background), so masks blend into the page instead of showing as black boxes. Light ink drawn on top stays readable. The adaptation assumes that default background: on a theme with a very different dark background, white masks show as slightly different boxes. To keep diagrams on a white background with untouched colors in dark mode, switch Dark mode colors to Light canvas.
dvilualatex matches standard LaTeX across tested math and TikZ blocks and supports fontspec system fonts.PATH; use Detect or add directories (such as /Library/TeX/texbin) to Extra PATH directories. Under Linux Flatpak, host TeX tools run automatically through flatpak-spawn --host.\documentclass. It loads TikZ with the everyday libraries (arrows.meta, calc, shapes.geometric, decorations.*, backgrounds, fit, matrix, …) and the AMS math packages. positioning is not preloaded on purpose: it changes what above right=4pt means in diagrams that never asked for it (the error hint names it when right=of … needs it). Inline \usepackage{...} and \usetikzlibrary{...} work regardless. A preamble saved unchanged from 1.0–1.2 is moved to the new default once; an edited one is kept.compat=1.18), tikz-cd, circuitikz, chemfig and tikz-3dplot made every compile about a third slower, so by default they load only for diagrams that use them (an axis, tikzcd, \chemfig, \tdplot…, a circuitikz component, …). A diagram that fails without them is compiled once more with all of them, so nothing that worked before stops working; it just takes a second compile. Always restores the 1.0–1.2 behaviour. Changing this, or updating to 1.3, recompiles diagrams once.TeX, then dvisvgm). 0 parallel compiles picks half your CPU cores (up to 4).data.json so mobile displays the error message instead of "not rendered yet".Other plugins can wait for diagrams to finish, for example before printing:
const tikz = app.plugins.plugins.tikz?.api; // missing in older versions
const { errors } = (await tikz?.whenSettled(root)) ?? { errors: 0 };
whenSettled(root) resolves once every diagram inside root (including hidden ones) shows a diagram, an error or "not rendered yet". errors counts the shown diagrams that show an error. Set data-tikz-theme="light" on root to get light colors in a dark app (see Dark mode).
dvisvgm, with an argument list and never through a shell. Under Flatpak it runs them on the host with flatpak-spawn --host.~/.cache/obsidian-tikz/ under Flatpak) and are deleted after each compile. The render cache stays in the plugin folder.Security
-shell-escape is never enabled unless explicitly turned on by the user.spawn/execFile), never interpolated shell strings.\input or \includegraphics any file your user account can read, and render it into the note and the plugin cache. TeX Live dropped openin_any read restrictions in 2026 as ineffective, so only open vaults you trust. Shell escape stays off either way.href/url() references, <style>, <a> and animation elements are removed. An SVG that cannot be parsed is rejected rather than displayed, and the result is inserted via DOMParser, never innerHTML.npm run dev # watch build (outputs main.js)
npm run build # typecheck + production bundle
npm run lint # eslint
npm run lint:review # what Obsidian's community plugin scanner checks
npm test # vitest unit tests
npm run m1 # integration tests against your real TeX install
npm run clean # clean generated bundle files
See AGENTS.md for architectural constraints and contribution rules.
MIT © 2026 Ding Zheng Yuan.
This plugin started as a fork of artisticat1/obsidian-tikzjax (MIT, © 2021–2023 artisticat1). The settings scaffolding and the ```tikz code block tag come from it; the rendering engine was rewritten to use a local TeX installation. Both copyright notices are kept in LICENSE.