← Back to list

mermaid-to-png
by MichaelVessia
⭐ 1🍴 0📅 Jan 24, 2026
SKILL.md
name: mermaid-to-png description: Convert mermaid diagrams in markdown files to PNG images. Use when the user wants to export markdown with mermaid to formats that don't support mermaid (Google Docs, PDF, etc). allowed-tools: Bash, Read
Mermaid to PNG
Extracts mermaid diagrams from markdown files, renders them to PNGs, and inserts image references after each mermaid block. The original mermaid code is preserved for future editing.
Usage
Run the script via bunx:
bunx ~/nixos-config/modules/programs/claude-code/skills/mermaid-to-png/mermaid-to-png.ts "<markdown-file>"
What it does
- Finds all
```mermaidcode blocks in the markdown file - Renders each to PNG via mermaid.ink API (no local browser needed)
- Saves PNGs to
assets/<filename-kebab-case>/diagram-N.png - Inserts
after each mermaid block - Preserves original mermaid code for future edits
Output structure
document.md
assets/
document/
diagram-1.png
diagram-2.png
...
Example
Before:
# My Doc
```mermaid
graph LR
A --> B
```
After:
# My Doc
```mermaid
graph LR
A --> B
```

Notes
- Uses mermaid.ink web API (requires internet)
- Filenames are converted to kebab-case (no spaces)
- White background for compatibility
- Idempotent: re-running will regenerate PNGs but not duplicate image refs (mermaid blocks without existing image refs get new ones)
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon