Render Mermaid Diagrams
Render Mermaid code blocks from Markdown files to high-quality SVG + PNG images using the MermaidChart theme. Use when the user wants to export, render, batch-convert, or screenshot Mermaid diagrams, or mentions mermaid-to-image, mermaid PNG, or diag
Install in one line
CLI$ mfkvault install render-mermaid-diagramsRequires the MFKVault CLI. Prefer MCP?
Free to install — no account needed
Copy the command below and paste into your agent.
Instant access • No coding needed • No account needed
What you get in 5 minutes
- Full skill code ready to install
- Works with 1 AI agent
- Lifetime updates included
Description
--- name: markdown-mermaid-export description: Render Mermaid code blocks from Markdown files to high-quality SVG + PNG images using the MermaidChart theme. Use when the user wants to export, render, batch-convert, or screenshot Mermaid diagrams, or mentions mermaid-to-image, mermaid PNG, or diagram export. --- # Render Mermaid Diagrams Batch-extract Mermaid code blocks from a Markdown file and render them as **SVG + PNG** using the MermaidChart theme — matching the Cursor/VS Code MermaidChart extension appearance. ## Prerequisites - **MermaidChart VS Code extension** — installed in Cursor or VS Code ([marketplace link](https://marketplace.visualstudio.com/items?itemName=MermaidChart.vscode-mermaid-chart)) - **Puppeteer** — installed globally: `npm i -g puppeteer` or `pnpm add -g puppeteer` - **Node.js** ≥ 18 ## Quick Start Determine the script path based on where this skill is installed: | Install type | Script path | | ------------ | ----------------------------------------------------------------------------- | | Personal | `~/.cursor/skills/markdown-mermaid-export/scripts/markdown-mermaid-export.sh` | | Project | `.cursor/skills/markdown-mermaid-export/scripts/markdown-mermaid-export.sh` | | Cloned repo | `<repo>/scripts/markdown-mermaid-export.sh` | ```bash bash <script-path> <markdown-file> ``` ## Output Files are written to `{filename}-mermaid/` next to the source Markdown: - `Untitled-{N}.png` — 8x high-DPI screenshot, full MermaidChart theme fidelity (gradient borders, shadows). Compatible with WPS, Office, Feishu, Google Docs, etc. - `Untitled-{N}.svg` — sanitized standalone SVG for browsers and technical docs. The output directory is **cleaned before each run** to avoid stale files. ## Configuration Environment variables (all optional): | Variable | Default | Description | | --------------- | ------- | -------------------------------------------- | | `MERMAID_SCALE` | `8` | PNG device scale factor (e.g. `2`, `4`, `8`) | | `MERMAID_THEME` | `mc` | Mermaid theme name passed to the renderer | Example: ```bash MERMAID_SCALE=4 bash <script-path> doc.md ``` ## How It Works - **Auto-discovery**: finds the MermaidChart extension and Puppeteer dynamically — no hardcoded paths, survives version upgrades - **Rendering engine**: loads the extension's bundled Mermaid library in headless Chromium for pixel-accurate output - **PNG**: screenshots from the original rendered DOM (preserves all visual effects) - **SVG sanitization**: converts `foreignObject` to native `<text>`, strips CSS animations/filters, converts `hsl()`/`rgba()` to hex — maximizing cross-renderer compatibility ## Trigger Examples - "把文档里的 Mermaid 图导出成图片" - "render mermaid diagrams from README.md" - "export architecture diagrams to PNG" - "批量渲染 mermaid 为 SVG"
Security Status
Unvetted
Not yet security scanned
Related AI Tools
More Grow Business tools you might like
Linear
FreeManaging Linear issues, projects, and teams. Use when working with Linear tasks, creating issues, updating status, querying projects, or managing team workflows.
codex-collab
FreeUse when the user asks to invoke, delegate to, or collaborate with Codex on any task. Also use PROACTIVELY when an independent, non-Claude perspective from Codex would add value — second opinions on code, plans, architecture, or design decisions.
Rails Upgrade Analyzer
FreeAnalyze Rails application upgrade path. Checks current version, finds latest release, fetches upgrade notes and diffs, then performs selective upgrade preserving local customizations.
Asta MCP — Academic Paper Search
FreeDomain expertise for Ai2 Asta MCP tools (Semantic Scholar corpus). Intent-to-tool routing, safe defaults, workflow patterns, and pitfall warnings for academic paper search, citation traversal, and author discovery.
Hand Drawn Diagrams
FreeCreate hand-drawn Excalidraw diagrams, flows, explainers, wireframes, and page mockups. Default to monochrome sketch output; allow restrained color only for page mockups when the user explicitly wants webpage-like fidelity.
Move Code Quality Checker
FreeAnalyzes Move language packages against the official Move Book Code Quality Checklist. Use this skill when reviewing Move code, checking Move 2024 Edition compliance, or analyzing Move packages for best practices. Activates automatically when working