mermaid-to-image

Convert Mermaid code blocks in text files to PNG images via mermaid.ink.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/zc277584121/marketing-skills --skill mermaid-to-image
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mermaid-to-image
Source: https://github.com/zc277584121/marketing-skills/tree/main/skills/mermaid-to-image
Command: npx skills add https://github.com/zc277584121/marketing-skills --skill mermaid-to-image

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many static publishing platforms and documentation sites do not render Mermaid diagrams directly, forcing authors to leave raw code blocks or manually produce images. This Skill automates detection and conversion of Mermaid code blocks into static PNG images, preserving diagrams in a format that renders consistently across sites.

Core Features & Use Cases

  • Detects Mermaid code blocks across single files or entire directories and reports the number and locations of diagrams found.
  • Renders diagrams to PNG using the mermaid.ink API with the required User-Agent header and saves images into a chosen project image directory.
  • Replaces original Mermaid code blocks with relative or absolute Markdown image references and supports naming conventions and handling of multiple blocks per file.
  • Use case: Convert diagrams in documentation or blog posts so they display reliably on GitHub Pages, Jekyll sites, or static blogs that do not support Mermaid.

Quick Start

Convert Mermaid code blocks in the specified Markdown file or folder into PNG images and replace each code block with an appropriate Markdown image reference.

Frequently Asked Questions about mermaid-to-image

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Mermaid diagrams to images for static Markdown documentation?

To convert Mermaid diagrams to images for static Markdown documentation, you can detect Mermaid code blocks in text files and render them into PNG images. This process replaces the original code blocks with Markdown image references for consistent display across static sites.

Why are my Mermaid diagrams not rendering on GitHub Pages or Jekyll sites?

Mermaid diagrams may not render on GitHub Pages or Jekyll sites because these platforms often do not support Mermaid natively. Converting the Mermaid code blocks into static PNG images ensures diagrams display reliably without requiring native platform rendering support.

Can I batch convert Mermaid code blocks across multiple files in a directory?

Yes, you can batch convert Mermaid code blocks across multiple files in a directory. The conversion process detects all Mermaid diagrams within the specified directory, renders them to PNG, saves them to an image folder, and updates the text files with appropriate image references.

Does converting Mermaid to PNG require a specific API or User-Agent header?

Converting Mermaid to PNG uses the mermaid.ink rendering API, which requires a specific User-Agent header to process the request successfully. The converted images are then saved to your chosen project image directory with descriptive filenames.

What is the best way to handle multiple Mermaid diagrams in a single Markdown file?

The best way to handle multiple Mermaid diagrams in a single Markdown file is to use an automated conversion tool that supports naming conventions for multiple blocks per file. It renders each diagram to a PNG image and replaces each specific code block with a relative or absolute image reference.