Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
zc277584121 avatar

Mermaid To Image

  • 2.9k installs
  • Updated July 30, 2026
  • zc277584121/marketing-skills

mermaid-to-image is an agent skill that Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.

About

Convert mermaid code blocks in Markdown or other text files into PNG images and replace the code blocks with image references Useful for platforms that don t render Mermaid natively GitHub Pages Jekyll Dev to etc The user asks to convert Mermaid diagrams in a file to images The user wants to render specific Mermaid code blocks as PNG A publishing workflow requires static images instead of Mermaid code blocks The user may specify A single file convert mermaid blocks in docs architecture md Multiple files convert mermaid in all files under docs A specific code block convert the second mermaid block in README md Scan the target file s for mermaid code blocks Report how many blocks were found and in which files before proceeding Step 2 Determine the image output directory

  • description: Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.
  • Convert ` ```mermaid ` code blocks in Markdown (or other text) files into PNG images, and replace the code blocks with i
  • - The user asks to convert Mermaid diagrams in a file to images
  • Follow mermaid-to-image SKILL.md steps and documented constraints.
  • Follow mermaid-to-image SKILL.md steps and documented constraints.

Mermaid To Image by the numbers

  • 2,871 all-time installs (skills.sh)
  • +225 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #272 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

mermaid-to-image capabilities & compatibility

Capabilities
description: convert mermaid code blocks in mark · convert ` ```mermaid ` code blocks in markdown ( · the user asks to convert mermaid diagrams in a · follow mermaid to image skill.md steps and docum
Use cases
orchestration
From the docs

What mermaid-to-image says it does

description: Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.
SKILL.md
Convert ` ```mermaid ` code blocks in Markdown (or other text) files into PNG images, and replace the code blocks with image references. Useful for platforms that don't render Mermaid natively (GitHub
SKILL.md
- The user asks to convert Mermaid diagrams in a file to images
SKILL.md
npx skills add https://github.com/zc277584121/marketing-skills --skill mermaid-to-image

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.9k
Security audit3 / 3 scanners passed
Last updatedJuly 30, 2026
Repositoryzc277584121/marketing-skills

When should an agent use mermaid-to-image and what problem does it solve?

Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.

Who is it for?

Developers invoking mermaid-to-image as documented in the skill source.

Skip if: Skip when requirements fall outside mermaid-to-image documented scope.

When should I use this skill?

Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.

What you get

Outputs aligned with the mermaid-to-image SKILL.md workflow and stated deliverables.

Files

SKILL.mdMarkdownGitHub ↗

Skill: Mermaid to Image

Convert `mermaid code blocks in Markdown (or other text) files into PNG images, and replace the code blocks with image references. Useful for platforms that don't render Mermaid natively (GitHub Pages/Jekyll, Dev.to, etc.).

---

When to Use

  • The user asks to convert Mermaid diagrams in a file to images
  • The user wants to render specific Mermaid code blocks as PNG
  • A publishing workflow requires static images instead of Mermaid code blocks

---

Workflow

Step 1: Identify target files

The user may specify:

  • A single file: convert mermaid blocks in docs/architecture.md
  • Multiple files: convert mermaid in all files under docs/
  • A specific code block: convert the second mermaid block in README.md

Scan the target file(s) for `mermaid code blocks. Report how many blocks were found and in which files before proceeding.

Step 2: Determine the image output directory

Check the project structure to find where images are typically stored:

# Look for common image directories
ls -d images/ img/ assets/ assets/images/ static/images/ docs/images/ 2>/dev/null

If a clear image directory exists (e.g., images/, assets/images/), use it. Create a subdirectory by topic if appropriate (e.g., images/<topic>/).

If no image directory is obvious or multiple candidates exist, ask the user:

Where should I save the rendered Mermaid images?

1. images/ (create new)
2. assets/images/
3. docs/figures/
4. Custom — enter a path

Step 3: Render each diagram to PNG

Use the mermaid.ink API to render diagrams. Run this Python snippet for each block:

import base64, urllib.request

def render_mermaid(code: str, output_path: str):
    """Render a Mermaid diagram to PNG via mermaid.ink API."""
    encoded = base64.urlsafe_b64encode(code.encode()).decode()
    url = f"https://mermaid.ink/img/{encoded}?bgColor=white"
    req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
    resp = urllib.request.urlopen(req, timeout=30)
    with open(output_path, "wb") as f:
        f.write(resp.read())

Important: The User-Agent header is required — mermaid.ink returns 403 without it.

Naming convention

Use descriptive filenames based on the diagram content, not generic names:

  • GOOD: architecture-overview.png, data-flow.png, heartbeat-sequence.png
  • BAD: mermaid-1.png, diagram.png, image1.png

Step 4: Replace code blocks with image references

Replace each `mermaid ... ` block with a Markdown image reference using a relative path from the file to the image:

![Architecture overview](images/topic/architecture-overview.png)

If the project uses absolute URLs (e.g., GitHub Pages), use those instead:

![Architecture overview](https://example.github.io/images/topic/architecture-overview.png)

Choose the link style that matches the project's existing image references. If unsure, use relative paths.

Step 5: Report results

After processing, summarize:

  • How many diagrams were converted
  • Where the images were saved
  • Which files were modified

---

Edge Cases

  • Large diagrams: mermaid.ink may time out on very complex diagrams. If a render fails, report the error and suggest the user simplify the diagram or try an alternative renderer.
  • Multiple blocks in one file: process all blocks in order, give each a unique descriptive filename.
  • Already-rendered blocks: if a mermaid block already has a corresponding image (commented out or adjacent), skip it or ask the user.
  • Non-Markdown files: the same approach works for any text file containing mermaid code blocks (e.g., .rst, .txt).

Related skills

FAQ

What is mermaid-to-image?

Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.

When should I use mermaid-to-image?

Convert Mermaid code blocks in Markdown files to PNG images using the mermaid.ink API.

Is mermaid-to-image safe to install?

Review the Security Audits panel on this page before production use.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.