Mermaid Boost

approvedunreviewed

by zemengzhou

Smart compact sizing, modern palettes, and interactive controls for Mermaid diagrams.

★ 1 stars↓ 442 downloadsUpdated 15d agoMIT

Mermaid Boost

Mermaid Boost — Smart Sizing, 29 Themes & Interactive Controls for Obsidian Mermaid Diagrams

Version Obsidian Themes CI License: MIT

English · 简体中文

Why Mermaid Boost? · Features · 29 Themes · Quick Start · Settings · Development


Why Mermaid Boost?

Mermaid diagrams in Obsidian often suffer from two extremes: sprawling architecture charts either overflow the reading column or shrink to microscopic, unreadable text.

Mermaid Boost enhances Obsidian's rendered Mermaid SVGs on the fly—adding a readability floor, 29 handcrafted themes, inline zoom controls, a double-click pan/zoom lightbox, and one-click HD PNG export—while keeping your note source 100% standard ```mermaid Markdown.

CapabilityDefault Obsidian MermaidWith Mermaid Boost
Large Diagram SizingShrinks unconstrained or overflows container4 Smart Presets (S / M / L / 1:1) with a strict Minimum Readable Scale floor
Tall FlowchartsPushes note content several screens downAuto-collapses tall diagrams cleanly instead of crushing text size
Visual StylingBasic default Mermaid skin29 curated themes across 7 groups (canvas, nodes, clusters, edges, fonts & SVG filters)
Navigation & InspectionStatic inline SVGToolbar Zoom (− / 72% / +) + Double-click Fullscreen Lightbox with smooth drag-pan
Sharing & ExportManual screenshot at screen DPIOne-click HD PNG Export directly from the diagram header
Markdown Lock-inStandard ```mermaid fence100% Standard ```mermaid fence — zero proprietary syntax

Features

1. Smart Diagram Sizing with Readability Floor

Mermaid Boost scales diagrams to fit a comfortable reading area while enforcing a Minimum Readable Scale floor so labels never become illegible. Tall diagrams can automatically collapse with an expand toggle rather than shrinking into a thin vertical strip.

PresetShortBase ScaleMax WidthMax HeightMin Readable ScaleBest For
Compact (default)S72%620 px320 px52%Dense study notes & side-by-side panes
BalancedM85%740 px440 px58%Everyday technical documentation
RelaxedL100%900 px580 px65%Wide monitors & architecture reviews
Original1:1100%1600 px2400 px100%Full 1:1 unconstrained presentation

2. Interactive Controls & Fullscreen Lightbox

Every enhanced diagram card exposes quick controls in its header toolbar:

  • Inline Zoom (− / 72% / +) — Adjust diagram scale on the spot or click the percentage badge to reset.
  • Double-Click Fullscreen Lightbox — Open any diagram in an interactive overlay with mouse-wheel zoom and click-drag panning.
  • One-Click HD PNG Export — Copy or export crisp, high-resolution raster images ready for slides, papers, or chat.

3. Per-Diagram Overrides (%% mermaid-boost: ...)

Need a different theme, size preset, or collapse behavior for a specific diagram? You can override global settings directly inside standard Mermaid comments:

```mermaid
%% mermaid-boost: theme=blueprint size=relaxed collapse=false
flowchart TD
    A[Global Settings Fallback] --> B[Diagram-Specific Override]
```

[!TIP] Standard Mermaid comments (%% ...) are completely ignored outside Obsidian, keeping your Markdown 100% portable on GitHub, GitLab, and documentation sites. Adjacent Markdown comments (<!-- mermaid-boost: ... -->) and the short prefix %%mb: ... are also supported.

Supported Override Keys

KeyDescriptionValid ValuesExample
themeOverride color palette & typographyAny of the 29 theme IDs (blueprint, nord, claude, etc.)theme=blueprint
sizeOverride sizing preset & readable floorcompact (s), balanced (m), relaxed (l), original (1:1)size=relaxed
collapseOverride auto-collapse on tall flowchartstrue / false (yes / no, 1 / 0)collapse=false
frameToggle card container border & backgroundtrue / false (none)frame=false
gridToggle dot-grid canvas backgroundtrue / false (dot / none)grid=true
headerToggle top micro-toolbartrue / falseheader=false
radiusOverride node & card corner radiusNumber in pixels (0 to 64, e.g. 8, 12px)radius=8

Precedence & Fallback Rules

  1. Per-diagram directive — Explicit keys in %% mermaid-boost: ... take highest precedence.
  2. Interactive session zoom — Temporary toolbar zoom adjustments scale on top of the diagram's base size.
  3. Global plugin settings — Vault-wide settings in Obsidian Settings act as the fallback for any unmentioned keys.
  4. Safe degradation — Unknown keys or malformed values fail safely and fall back to global settings without mutating global configuration.

29 Themes Across 7 Groups

Mermaid Boost 29 Themes Gallery

Themes restyle the entire SVG hierarchy—canvas background, primary/secondary nodes, subgraph clusters, notes, edge paths, edge labels, typography, corner radius, and decorative SVG filters (hand-drawn wobble, neon/CRT glow, blueprint grids, and corkboard textures).

GroupTheme IDDisplay NamePalette & TypographySignature Visual Character
1. Styled (4)claude (default)ClaudeCream #faf9f5 · Clay #c6613f · SerifWarm editorial card with rounded nodes & terracotta accents
notionNotionPure White #ffffff · Soft Grey #f7f6f3 · SansClean, understated workspace aesthetic with warm yellow notes
notion-darkNotion darkCharcoal #191919 · Slate #252525 · SansLow-glare dark mode workspace styling
handcraftedHandcraftedWarm Paper #fdf6e3 · Marker #fff3b0 · HandSketchbook feel with hand-drawn SVG wobble filter
2. Developer (4)nordNordPolar Night #2e3440 · Frost #88c0d0 · SansArctic blue-grey developer palette
draculaDraculaDark Slate #282a36 · Purple #bd93f9 · Pink #ff79c6High-contrast vampire dark theme with neon pink edges
solarizedSolarizedCream #fdf6e3 · Teal Blue #268bd2 · SansEthan Schoonover's precision warm light palette
gruvboxGruvboxRetro Dark #282828 · Amber #fabd2f · SansWarm earthy retro terminal palette
3. Paper & Print (4)blueprintBlueprintTechnical Blue #0b3d91 · Crisp White #ffffff · MonoDrafting table aesthetic with 20px coordinate grid
newspaperNewspaperNewsprint #f2efe8 · Press Ink #111111 · SerifHigh-contrast editorial print typography
academicAcademicPure White #ffffff · Greyscale #333333 · SerifComputer Modern / Times styling tailored for papers & theses
kraft-paperKraft paperBrown Stock #c9a97a · Espresso #4a3520 · MonoStamped parcel paper look with warm kraft tones
4. Retro & Playful (5)chalkboardChalkboardSlate Green #2f3e37 · Chalk #f5f5f0 · HandClassroom chalkboard with wobbly hand-drawn lines
terminal-crtTerminal / CRTPhosphor Black #050805 · Green #33ff66 · MonoRetro green CRT monitor with phosphor glow filter
game-boyGame BoyDMG Olive #9bbc0f · Deep Green #0f380f · MonoClassic 4-shade handheld LCD palette
synthwaveSynthwaveMidnight #1a0b2e · Neon Pink #ff2e97 · Cyan #00f0ffOutrun 80s neon glow with cyan laser connectors
sticky-notesSticky notesCorkboard #c89f6b · Multi-color Post-its · HandRadial cork texture with cycling yellow, pink & mint notes
5. Brand-Inspired (5)github-lightGitHub lightWhite #ffffff · Neutral #f6f8fa · Green #1a7f37Familiar GitHub Primer light documentation look
github-darkGitHub darkDimmed #0d1117 · Canvas #161b22 · Green #238636GitHub Primer dark mode palette
linearLinearObsidian #0b0b0f · Indigo #5e6ad2 · SansNear-black precision interface with subtle violet glow
stripeStripeCrisp White #ffffff · Blurple #635bff · Cyan #00d4ffFinTech product documentation styling
metro-mapMetro mapWhite #ffffff · Bold Station #111111 · Transit LinesThick 6px cycling red/blue/green transit routes & station nodes
6. Functional (3)high-contrastHigh contrastWhite #ffffff · Pure Black #000000 · Yellow #ffff003px heavy borders & maximum legibility
colorblind-safeColorblind-safeWhite #ffffff · Okabe-Ito 6-color cycleScientifically distinguishable multi-category node palette
mono-accentMono + one accentZinc Grey #f4f4f5 · Signal Orange #e8590cMuted greyscale baseline that spotlights key nodes in orange
7. Built-in (4)builtin-defaultdefaultClassic Lavender #ECECFF · Border #9370DBStandard Mermaid default palette with Boost sizing & controls
builtin-neutralneutralNeutral Grey #f4f4f4 · Border #666666Standard Mermaid neutral monochrome palette
builtin-darkdarkDark Charcoal #1f2020 · Steel #81B1DBStandard Mermaid dark palette
builtin-forestforestForest Mint #cde498 · Pine #13540cStandard Mermaid forest green palette

Quick Start & Installation

Option 1: Install via GitHub Release / BRAT

  • From GitHub Releases (v1.0.5): Download mermaid-boost-1.0.5.zip and extract its files into <Vault>/.obsidian/plugins/mermaid-boost/, or download manifest.json, main.js, and styles.css individually and copy them into that folder.
  • Via Obsidian BRAT: Add beta plugin repository dreamfarer-space/obsidian-mermaid-boost and enable Mermaid Boost.

Option 2: Manual Installation

  1. Create the plugin folder inside your Obsidian vault:
    <Vault>/.obsidian/plugins/mermaid-boost/
    
  2. Copy these three runtime files from the repository into that folder:
    • manifest.json
    • main.js
    • styles.css
  3. Reload Obsidian (Ctrl/Cmd + R).
  4. Navigate to Settings → Community plugins and enable Mermaid Boost.

[!NOTE] Requires Obsidian 1.5.0+. Works across both desktop and mobile (isDesktopOnly: false).

Usage

Write standard Mermaid fenced code blocks in any note—no custom codeblock syntax needed:

```mermaid
flowchart LR
    A[Write Standard Mermaid] --> B[Obsidian Renders SVG]
    B --> C[Mermaid Boost Applies Theme & Smart Scale]
    C --> D[Interactive Zoom, Lightbox & HD PNG]
```

Settings Reference

Configure all options under Obsidian Settings → Mermaid Boost:

CategorySettingDefaultDescription
SizingSize presetcompactChoose compact (S), balanced (M), relaxed (L), or original (1:1).
Base scale0.72Initial display scale before container constraints are evaluated.
Max width620 pxTarget maximum width before proportional downscaling kicks in.
Max height320 pxTarget maximum height before scaling or auto-collapse applies.
Min readable scale0.52Hard readability floor preventing huge diagrams from shrinking too far.
Auto-collapse tall diagramsOnCollapses overly tall diagrams behind an expand toggle.
AppearanceThemeclaudeSelect any of the 29 themes across 7 groups.
Node radius12Corner rounding radius applied to diagram nodes.
Multi-tone nodesOffCycles secondary/accent tones across nodes when supported by the theme.
Trim pie paddingOnStrips excessive whitespace around Mermaid pie charts.
Card & UICard frameOnWraps rendered diagrams in a themed card container.
Dot gridOffAdds a subtle architectural dot-grid pattern to the card background.
Header barOnDisplays the top bar with zoom buttons, scale badge, and PNG export.
InteractionDouble-click fullscreenOnOpens the interactive pan/zoom lightbox on double-click.
Zoom sensitivity1.0Fine-tunes wheel and button zoom step responsiveness.

Development

Mermaid Boost uses a modular source architecture in src/ and generates the distributable runtime bundle main.js with esbuild.

# Install development dependencies
npm install

# Build the distributable main.js bundle
npm run build

# Watch mode for interactive development
npm run dev

# Verify the committed main.js bundle is up to date with src/
npm run build:check

# Run the Node.js unit test suite (requires Node.js 22+)
npm test

# Validate plugin manifest, versions.json, and documentation version consistency
npm run validate

# Run syntax validation
node --check main.js
node --check scripts/build.js
node --check scripts/validate-plugin.js
node --check src/main.js
node --check src/settings.js
node --check src/sizing.js
node --check src/themes.js
node --check src/beautify.js
node --check src/lightbox.js
node --check src/export.js
node --check tests/helpers.js
node --check tests/sizing.test.js
node --check tests/themes.test.js
node --check tests/beautify.test.js
node --check tests/plugin.test.js
node --check tests/validation.test.js

Repository Structure

File / DirectoryResponsibility
src/main.jsObsidian plugin entry point, lifecycle management, DOM observer, and block decoration
src/settings.jsSettings presets (SIZE_PRESETS), DEFAULT_SETTINGS, and Obsidian PluginSettingTab
src/sizing.jsSizing calculation engine, diagram type detection, and pie padding tightening
src/themes.js29 theme palettes (THEMES), theme groups (THEME_GROUPS), and theme spec resolver
src/beautify.jsSVG DOM beautification pipeline, node styling, and topology classifier
src/lightbox.jsInteractive fullscreen pan/zoom lightbox modal with controls
src/export.js3x HD PNG export engine and live CSS color resolution
tests/Automated unit and integration test suite (sizing, themes, beautify, plugin, validation)
main.jsGenerated standalone distribution bundle for Obsidian
scripts/build.jsFast bundling script using esbuild with --check and --watch support
scripts/validate-plugin.jsMetadata schema, release tag, and documentation version consistency validator
styles.cssCard containers, toolbar buttons, fullscreen lightbox modal, and theme CSS rules
manifest.jsonObsidian plugin manifest metadata (1.0.5, minAppVersion: 1.5.0)
assets/SVG visual banners and theme showcase graphics used in documentation

Release Process

  1. Update version metadata in manifest.json, package.json, versions.json, CHANGELOG.md, README.md, and README.zh-CN.md.
  2. Run npm run build, npm run build:check, npm test, and npm run validate locally to verify bundle freshness, tests, schema, and version synchronization.
  3. Push a matching semantic version tag (TAG=$(node -p "require('./manifest.json').version") && git tag "$TAG" && git push origin "$TAG"). GitHub Actions automatically runs the test suite, validates release metadata against the tag, builds mermaid-boost-<version>.zip, and publishes main.js, manifest.json, styles.css, and the ZIP bundle to GitHub Releases.

Contributing & License

Issues and Pull Requests are welcome! When modifying sizing math, themes, or plugin behavior in src/, please run npm run build, npm run build:check, npm test, and npm run validate to ensure all assertions pass and the bundle remains in sync.

Released under the MIT 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.