Mermaid Zoom
unlistedby diabel
Pan, zoom, and navigate Mermaid diagrams with a GitHub-style control panel. Supports mouse drag, touch/pinch (mobile), and Alt+Scroll.
Mermaid Zoom
Fix oversized, unreadable, or overflowing Mermaid diagrams in Obsidian. Mermaid Zoom wraps every diagram in an interactive viewer with zoom, pan, drag, and resize โ so large flowcharts, sequence diagrams, and entity-relationship diagrams stay readable at any scale, on desktop and mobile.
Features
- Zoom in / out โ buttons or
Alt+Scroll - Pan โ arrow buttons, or drag when pan-lock is active (๐)
- Fit to view โ scales the diagram to fill the current container
- Reset โ snaps back to 1:1 scale at the origin
- Pinch-to-zoom โ native touch gesture on mobile / tablet
- Resizable container โ drag the corner to resize the diagram box (width and height)
- Configurable โ zoom step, pan step, and panel opacity via Settings
- Clean unload โ disabling the plugin fully restores the original diagram DOM
Control panel
The panel fades in when you hover over a diagram (always visible on touch screens).
| Button | Action |
|---|---|
โ | Zoom in |
โ | Zoom out |
โฒ โผ โ โถ | Pan in that direction |
๐ / ๐ | Toggle pan-lock โ when locked, drag the diagram to pan |
โ | Reset to original scale and position |
โคข | Fit diagram to the container |
Alt+Scroll | Zoom with the mouse wheel (no conflict with Obsidian shortcuts) |
| Pinch | Pinch-to-zoom on touch screens |
Installation
Manual
- In Obsidian: Settings โ Community plugins โ turn off Restricted mode if it's on.
- Go to the latest release and download
main.js,styles.css, andmanifest.json. - In your vault folder, create the directory
.obsidian/plugins/mermaid-zoom/and place all three files inside it. - Back in Obsidian: Settings โ Community plugins โ click the Reload plugins button (โบ), then find Mermaid Zoom in the list and enable it.
Via BRAT (beta testing)
- Install the BRAT plugin.
- Open BRAT settings โ Add Beta Plugin.
- Enter:
HuuDoe/obsidian-mermaid-zoom
Settings
Open Settings โ Mermaid Zoom to configure:
| Setting | Default | Description |
|---|---|---|
| Zoom step | 1.08 | Multiplier per click or scroll tick (1.08 = 8% per step) |
| Pan step | 40 px | Pixels moved per arrow-button click |
| Panel resting opacity | 0.25 | Opacity when diagram is not hovered (0 = hidden, 1 = always visible) |
Development
Requirements: Node.js โฅ 18
git clone https://github.com/HuuDoe/obsidian-mermaid-zoom
cd obsidian-mermaid-zoom
npm install
# Watch mode (rebuilds on every save)
npm run dev
# Production build
npm run build
To test in Obsidian, copy main.js, styles.css, and manifest.json into your vault's .obsidian/plugins/mermaid-zoom/ folder and reload the app.
Releasing a new version
- Run
npm version patch(orminor/major) โ automatically bumpsmanifest.jsonandversions.json. - Push the tag:
git push --follow-tags - Create a GitHub Release for that tag and attach
main.js,styles.css, andmanifest.jsonas binary assets.
Changelog
v1.1.2 โ 2026-04-08
- Mobile: pinch-to-zoom snap fixed โ lifting fingers one at a time no longer causes a jarring jump in zoom or position
- Mobile: auto-size (โก) fixed โ now fits to available screen width on mobile instead of rendering at 1:1 scale and overflowing
v1.1.1 โ 2026-04-08
- Settings: added Reset to defaults button
- Mobile: fixed swipe-to-open-sidebar triggering while panning a diagram
- Mobile: fixed two-finger pinch triggering browser back/forward navigation
- Mobile: eliminated touch drag lag via
touch-action: none
v1.1.0 โ 2026-04-08
- Persist container height per diagram โ saved to
data.json, restored on note reopen - Cursor-anchored zoom โ Alt+Scroll and pinch-to-zoom keep the point under the cursor stationary
- Lucide lock icons โ drag-toggle uses Obsidian's native
lock-open/lockicons - Mermaid color theming โ node, cluster, edge, and label colours overridden to match active Obsidian theme
- Edge label background patched via
mermaid.initialize()to match--background-secondary - Auto-size (โก) โ sets both width (capped at note column) and height from SVG viewBox
- Fit to view (โคก) โ scales to fill available width, shrinks container height to eliminate blank gaps
- Drag-to-pan on by default โ pan lock starts active; button toggles it off
- SVG locked to natural pixel dimensions โ resizing the wrapper no longer rescales the chart
v1.0.0 โ initial release
- Zoom, pan, drag, pinch-to-zoom, fit, reset
- Resizable container with corner handle
- Configurable zoom step, pan step, panel opacity
- Desktop and mobile support
License
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.