leo62 downloadsTake over mermaid rendering in reading view with theme-aware styling, style packs, pan & zoom, PNG export, and readable error messages.
English | 简体中文
Diagrams that feel like they belong in your notes.
Your notes have a theme. Your diagrams don't — the same purple boxes, mismatched fonts, and edges that cross like spaghetti. Best Mermaid re-renders every mermaid diagram in your vault with your theme's own colors, curated styles, and professional layout. No configuration. No new syntax.
Install it, open a note, and it just looks right.

Left: the default Obsidian mermaid renderer. Right: Best Mermaid with the Paper style — theme-matched grayscale palette and clean orthogonal routing.

Ctrl + scroll zooms at the cursor (trackpad pinch works too); drag to pan; double-click to reset — zoom stays put across re-renders.

Click the download icon at the bottom-right of any diagram: edit the file name, pick 1x–4x quality, and save anywhere through the native save dialog.

The style gallery: four built-in style packs with live swatches. Pick a default here; override any single diagram with %% bm-style: <id> %%.
There are several mermaid appearance plugins already. Best Mermaid differs in a few ways:
```mermaid blocks in reading view, replacing the built-in renderer%%{init}%% directives respected — in-diagram directives merge over plugin settings (user intent always wins); themeCSS appends instead of replacingCtrl + scroll to zoom at the cursor (trackpad pinch works), drag to pan, double-click to reset; zoom state survives re-rendersWrite mermaid blocks as usual:
```mermaid
flowchart LR
A[Start] --> B[End]
```
Pin a style to a diagram (the directive is a comment — Obsidian without this plugin ignores it safely):
```mermaid
%% bm-style: midnight %%
flowchart LR
A --> B
```
In-diagram customization still works and takes priority over the plugin:
```mermaid
%%{init: {'themeVariables': {'primaryColor': '#ffd54f'}}}%%
flowchart TB
A[Custom gold] --> B
```
| id | name | notes |
|---|---|---|
follow |
Follow theme | dynamic, resolves theme CSS variables |
midnight |
Midnight | static, dark presentation look |
paper |
Paper | static, orthogonal routing via elk |
terra |
Terra | static, warm humanist palette |
| Action | Effect |
|---|---|
Ctrl + scroll / trackpad pinch |
zoom anchored at cursor (0.2×–8×) |
| Drag (when zoomed) | pan |
| Double-click | reset to 100% |
| Zoom out below 100% and pause | snaps back to fit |
isDesktopOnly: true); the bundle includes mermaid + elk (~12 MB)npm install
npm run dev # esbuild watch
npm test # vitest + jsdom, real mermaid render pipeline tests
npm run build # type-check + production bundle
Manual install for testing: copy main.js, manifest.json, styles.css into <vault>/.obsidian/plugins/best-mermaid/.