# mermaid-to-image

mermaid-to-image converts Mermaid diagrams in Markdown files to PNG via the mermaid.ink API and replaces code blocks with image references.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 4000 installs
- Author: zc277584121
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/zc277584121/marketing-skills/tree/HEAD/skills/mermaid-to-image/SKILL.md
- Updated: 2026-08-28
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/mermaid-to-image

## What it does

The skill locates Mermaid code blocks in specified files, renders each to PNG through an external API, and substitutes the code with an image link. Inside is a Python script that encodes the diagram in base64, sends a request with a `User-Agent` header (the API returns 403 without it), and saves the result to a chosen directory. Image paths are formed relative to the file or absolute, depending on project structure.

Useful for publishing docs on platforms where Mermaid does not render natively: GitHub Pages with Jekyll, Dev.to, static sites. The skill suggests an image directory when the project has several candidates (`images/`, `assets/`, `docs/figures/`) and generates filenames based on diagram content. Standard Python library is sufficient.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add zc277584121/marketing-skills --skill mermaid-to-image -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/mermaid-to-image/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/mermaid-to-image/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add zc277584121/marketing-skills --skill mermaid-to-image -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/mermaid-to-image/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add zc277584121/marketing-skills --skill mermaid-to-image -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/mermaid-to-image/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install zc277584121/marketing-skills skills/mermaid-to-image
```

2. **Manually: put the files in place**
- File: `.github/skills/mermaid-to-image/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add zc277584121/marketing-skills --skill mermaid-to-image -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/zc277584121/marketing-skills --path skills/mermaid-to-image
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/mermaid-to-image/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add zc277584121/marketing-skills --skill mermaid-to-image -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/zc277584121/marketing-skills/tree/HEAD/skills/mermaid-to-image/SKILL.md

## When to use it
- turn Mermaid blocks into PNG for publishing on a platform without diagram rendering
- replace diagram code in Markdown with links to ready images
- prepare documentation with diagrams for a static site
- save PNG versions of all schemas from a file or folder

## Example prompts
- Convert Mermaid blocks in `docs/architecture.md` to images
- Turn all diagrams from `docs/` folder into PNG
- Replace the second Mermaid schema in README with an image

## Similar
- [mermaid-tools](https://affpapa.org/en/nevibecode/skills/mermaid-tools.md) — skill · 1500 installs
- [mermaid-diagram-generator](https://affpapa.org/en/nevibecode/skills/mermaid-diagram-generator.md) — skill · 348 installs
- [diagram-to-image](https://affpapa.org/en/nevibecode/skills/diagram-to-image.md) — skill · 515 installs
- [mermaid-visualizer](https://affpapa.org/en/nevibecode/skills/mermaid-visualizer.md) — skill · 1700 installs
- [beautiful-mermaid](https://affpapa.org/en/nevibecode/skills/beautiful-mermaid.md) — skill · 1900 installs
- [mermaid-flowchart-generator](https://affpapa.org/en/nevibecode/skills/mermaid-flowchart-generator.md) — skill · 174 installs

From the same set: [zc277584121/marketing-skills](https://affpapa.org/en/nevibecode/by/zc277584121/marketing-skills.md) — 13 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
