Skip to content

Markdown Integration

Last updated:

Mermaid Studio provides complete language support for Mermaid diagrams embedded in Markdown files. Diagrams are rendered live as you type. This is especially useful for README files, documentation, and wikis.

To add a Mermaid diagram to a Markdown file, use a fenced code block with the mermaid or mmd language identifier:

markdown-preview

Mermaid Studio recognizes these blocks and provides full editor support.

Image artifacts left next to your .mmd source — typically .mmd.svg / .mmd.png files written by Diagram Sync — now show a gutter icon on every Markdown link or image reference that targets them. Click the icon (or press the Go to Mermaid Source action) to jump from the artifact reference to the source .mmd / .mermaid file.

See Gutter Icons → Mermaid source link for the full behavior.

All of Mermaid Studio’s export actions work directly inside Markdown code fences. Right-click inside a mermaid (or mmd) fenced code block and hover over Export Diagram to access:

Each action targets the Mermaid diagram under the caret, so Markdown files containing multiple Mermaid blocks can export each one independently. The export carries the fence’s own frontmatter (theme and config), and indented fences export as dedented source, so the output matches the inline preview. The export bakes the light or dark variant the IDE theme calls for, the same rule the Markdown preview uses; see Export appearance.

Right-click inside a mermaid or mmd code fence and choose Switch Diagram Theme to open a searchable popup of the built-in Mermaid.js themes plus the enabled bundled and custom themes. The popup’s Light/Dark toggle switches the fence between its light and dark variant. Picking a theme writes it into that fence’s frontmatter, so each diagram in a Markdown file can carry its own theme. See Switching themes for the popup’s keyboard shortcuts and what it writes.

Hovering over a Mermaid diagram in the preview panel reveals a Copy to clipboard button in its top-left corner and a toolbar in its top-right corner:

  • Zoom in and Zoom out
  • Actual size — Show the diagram at its natural width
  • Fit to preview — Return the diagram to the width of the preview
  • Open in new window — Open the diagram in a separate window for easier viewing
  • Show source — Toggle between the rendered diagram and its highlighted Mermaid code

A hovered Mermaid diagram in the Markdown preview, with the copy button in its top-left corner and the toolbar in its top-right corner

Zoom into a diagram that is too small to read at document width and it scrolls inside its own block, so you can read its labels without losing your place in the document:

Pan a zoomed diagram with a middle-click drag, as in the standalone preview, or with the arrow keys when the diagram is focused. Editing the document doesn’t reset a diagram’s zoom.

Clicking Show source switches the fence to its Mermaid source code with syntax highlighting, and Show diagram switches it back.

The source view includes limited syntax highlighting. Some advanced semantic highlighting features may not be available in the preview panel.

markdown-source-diagram-toggle

Clicking Open in new window opens the rendered diagram in a separate window with the standalone preview’s zoom and pan controls, including keyboard shortcuts and trackpad gestures. The diagram renders in that window as it appears inline. It follows the IDE theme rather than the standalone preview background setting, while its runtime configuration overrides come from the Preview context.

markdown-popout

You can configure how diagrams appear in the Markdown preview, including inline display mode and maximum size constraints. See Markdown configuration for details, including a setting to disable Mermaid’s contributions to the platform Markdown preview entirely.

Coexistence with the bundled JetBrains Mermaid plugin

Section titled “Coexistence with the bundled JetBrains Mermaid plugin”

JetBrains IDEs from 2026.2 on bundle their own Mermaid plugin, and its Markdown preview rendering overlaps with Mermaid Studio’s. When both are enabled, Mermaid Studio keeps its editor-side support inside mermaid and mmd code fences (syntax highlighting, completion, validation, and the Element Style pane), but Markdown preview rendering defers to the bundled plugin. While it does, Mermaid Studio’s preview features are unavailable, including runtime version pinning, icon sets, and the extended layout engines. A banner on affected Markdown files offers a shortcut to disable the bundled plugin.

Disabling the bundled plugin under Settings > Plugins restores Mermaid Studio’s full preview on the next preview reload, with no IDE restart. Mermaid Studio also shows a one-per-session notification recommending this; see Installation.