jcmexdev393 downloadsConvert Mermaid code blocks to static image URLs (SVG, PNG, or WebP)

Convert Mermaid code blocks to static image URLs (SVG, PNG, or WebP) using the free Kroki or Mermaid.ink APIs, and restore them back to editable code blocks instantly. This speeds up note loading, keeps your vault clutter-free, and ensures consistent rendering across devices.

).You start with a standard Mermaid code block:
```mermaid
graph TD
A --> B
```
Click the Convert to URL hover button or right-click and select Convert to URL. The block is replaced by a clean markdown image link containing the compressed diagram code:

When you want to edit the diagram, click the Restore URL to Mermaid button (indicated by the history icon ↩️) or right-click the image and select Restore URL to Mermaid. The diagram code is decoded directly from the URL and restored back to a clean code block!
[!TIP] Use diagram metadata to control naming, sizing, and alt text Add a title and/or width to your diagrams to control how they are converted and displayed. See the Diagram Metadata section below for the full syntax reference.
).
) to select:
Open the Command Palette (Ctrl/Cmd + P) and run:
Mermaid Block to Image: Download imageMermaid Block to Image: Convert to URLMermaid Block to Image: Restore URL to MermaidYou can embed metadata directly inside your Mermaid code block to control the title, file name, and initial display width of any converted diagram. The plugin reads this before conversion and applies it automatically.
The title is used as the alt text of the generated image link and as the file name when downloading. Without a title, the plugin falls back to Mermaid Diagram and a generic hash for file names.
[!IMPORTANT] Always use YAML frontmatter to set the title. It is the most reliable syntax and works consistently across all diagram types and Mermaid versions.
Recommended — YAML frontmatter:
```mermaid
---
title: "My Network Architecture"
---
flowchart TD
A --> B
```
Result: 
Download: my-network-architecture.png
Set a default display width for the image at conversion time. The plugin embeds it in the alt text as , which Obsidian uses to size the image. You can always adjust it later with the drag-to-resize handle.
YAML frontmatter:
```mermaid
---
title: "CI/CD Pipeline"
width: 800
---
flowchart TD
A --> B
```
[!NOTE] Width values are in pixels. If omitted, the default is
500px. Percentage values (e.g.width: 100%) are also accepted and will use a fixed1200pxAPI width for rendering.
To customize the plugin, go to Settings ➔ Mermaid Block to Image:
If you encounter any issues or have feature requests, please open an issue on GitHub.