mermaid-to-png
SKILL.md
mermaid-to-png
Convert Mermaid code blocks in Markdown files to styled PNG/SVG images with built-in themes.
Use This Skill When
- The input is a Markdown file containing
mermaidcode blocks - The user wants PNG/SVG exports, visual polish, or image replacement in the Markdown
- The target is an article, slide deck, blog post, or WeChat Official Account post
- The user says "make this Mermaid diagram look better" without naming a file format
Workflow
- Inspect the Markdown file and confirm it contains Mermaid code blocks.
- Run the bundled converter:
python3 mermaid-to-png/scripts/convert.py <input-file> --style fresh-business --width 900 --replace
- Pick a style based on context:
fresh-business: reports, docs, business/process diagramsdark-tech: architecture, engineering, API/system diagramshand-drawn: ideation, teaching, workshop notesgradient-modern: product, marketing, keynote-style visuals
- Use
--width 900for WeChat unless the user requests something else. - Add
--replacewhen the user wants a Markdown file with image references.
Key Options
--style <name>: apply one built-in theme--format png|svg: choose raster or vector output--width <px>: image width, default1200--replace: emit<input>_converted.mdwith Mermaid blocks replaced by image links--output-dir <dir>: store generated assets in a specific directory--chart-type auto|flowchart|sequence|gantt|class|state: override type detection only if auto-detection is wrong--allow-npx: allow a dynamicnpxfallback only when localmmdcis unavailable--disable-browser-sandbox: disable Chromium sandbox only in trusted restricted environments
Notes
- The converter auto-detects common Mermaid chart types.
- When
--replaceis used, the converted Markdown references image filenames in the same output directory. - Prefer a locally installed
mmdc. npxfallback is disabled by default and must be explicitly enabled with--allow-npx.- Browser sandbox disabling is also opt-in via
--disable-browser-sandbox.
Prerequisites
npm install -g @mermaid-js/mermaid-cli
If rendering fails, check Mermaid syntax first, then verify mmdc/Puppeteer can run in the local environment.
Weekly Installs
1
Repository
haiyuan-ai/agent-skillsFirst Seen
3 days ago
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1