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.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "mermaid-to-png" with this command: npx skills add michaelvessia/nixos-config/michaelvessia-nixos-config-mermaid-to-png

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 ```mermaid code 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 Diagram N 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

graph LR
    A --> B

After:

My Doc

graph LR
    A --> B

Diagram 1

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)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

proxmox

No summary provided by upstream source.

Repository SourceNeeds Review
General

obsidian-save

No summary provided by upstream source.

Repository SourceNeeds Review
General

home-assistant-manager

No summary provided by upstream source.

Repository SourceNeeds Review
General

md-to-html

No summary provided by upstream source.

Repository SourceNeeds Review