xiaohongshu
xiaohongshu
mermaid-export
Export Mermaid diagrams from documents to PNG images. MUST be run immediately after creating or editing any Mermaid diagram, BEFORE committing. Processes .md, .html, .mdx, .rst, .adoc files.
Full skill instructions
Render Mermaid diagrams in documents to PNG images using the mermaid-renderer tool.
CRITICAL RULE: Always render diagrams immediately after creating or editing Mermaid code. Never commit a document with unrendered Mermaid diagrams.
~/.claude/tools/mermaid-renderer/
├── render-mermaid.js # Single diagram renderer
└── process-document.js # Full document processor
When creating a document with Mermaid diagrams, use the standard mermaid skill to generate the diagram code:
# My Document
Here's the architecture:
```mermaid
flowchart LR
A[Client] --> B[API Gateway]
B --> C[Service]
More content...
### Step 2: Export Diagrams to SVG
After creating/editing a document with Mermaid blocks, run:
```bash
node ~/.claude/tools/mermaid-renderer/process-document.js <document-path> --verbose
Options:
--theme=<theme> - Mermaid theme: default, forest, dark, neutral--verbose - Show detailed progress--dry-run - Preview without making changesThe tool will:
\``mermaid` code blocksdiagrams/{document-name}/Output structure:
document.md
diagrams/
└── document/
├── diagram-1.svg
├── diagram-2.svg
└── architecture-diagram.svg
Document transformation:
<!-- Before -->
` ``mermaid
flowchart LR
A --> B
` ``
<!-- After -->

<details>
<summary>Mermaid Source</summary>
` ``mermaid
flowchart LR
A --> B
` ``
</details>
IMPORTANT: Use a collapsible <details> block (not HTML comments) to preserve the source. This keeps the document clean while making the source visible and editable.
To render a single diagram without processing a full document:
# From a .mmd file
node ~/.claude/tools/mermaid-renderer/render-mermaid.js diagram.mmd output.svg
# From stdin
echo "flowchart TD; A-->B" | node ~/.claude/tools/mermaid-renderer/render-mermaid.js --stdin output.svg
# With theme
node ~/.claude/tools/mermaid-renderer/render-mermaid.js diagram.mmd output.svg --theme=dark
| Extension | Image Syntax Used |
|---|---|
.md, .markdown |  with HTML comment |
.html, .htm | <img> tag with HTML comment |
.mdx | JSX <img> with JSX comment |
.rst | .. image:: directive |
.adoc | image:: macro |
This skill works together with the main Mermaid diagram skill:
MANDATORY workflow:
DO NOT commit a document containing unrendered mermaid blocks. The render step is not optional.
Diagrams are named based on:
diagram-1, diagram-2, etc.To control naming, add a title:
---
title: Architecture Overview
---
flowchart LR
...
→ Generates architecture-overview.svg
To edit a previously rendered diagram:
<details> block to view the mermaid source<details> blockThe tool automatically detects the rendered pattern ( + <details> with mermaid source) and re-renders the images without modifying the document structure.
This renderer fully supports ELK layout for complex diagrams:
---
config:
layout: elk
elk:
mergeEdges: true
---
flowchart LR
...
The tool handles two scenarios:
When it finds the rendered pattern:

<details>
<summary>Mermaid Source</summary>
` ``mermaid
flowchart LR
A --> B
` ``
</details>
The tool:
<details>When it finds a standalone mermaid block (not inside <details>):
` ``mermaid
flowchart LR
A --> B
` ``
The tool:
<details> structurePuppeteer needs Chromium. Install globally: npm install -g puppeteer
layout: elkThe tool auto-sizes based on diagram content. For custom sizing, edit the generated SVG or use CSS in your document.
Ensure the document has the correct pattern:  followed by <details> with <summary>Mermaid Source</summary> and the mermaid code block. The pattern matching is strict to avoid false positives.
# Process a markdown file
node ~/.claude/tools/mermaid-renderer/process-document.js ./docs/README.md --verbose
# Process with dark theme
node ~/.claude/tools/mermaid-renderer/process-document.js ./docs/arch.md --theme=dark
# Dry run to see what would happen
node ~/.claude/tools/mermaid-renderer/process-document.js ./docs/README.md --dry-run
# Render single diagram
node ~/.claude/tools/mermaid-renderer/render-mermaid.js ./diagrams/flow.mmd ./output/flow.svg
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience