Nov 10, 2026
pretty-mermaid: Turn Mermaid Source into Polished SVG, Shareable PNG, and Terminal ASCII — Locally, Without a Browser
A 2k-star agent skill that renders one Mermaid source into polished SVG, shareable PNG, and terminal-ready ASCII — locally and browser-free, with 15 built-in themes and six diagram types.
An agent can draft a Mermaid diagram in seconds; making the same picture look good in a README, a chat, and a terminal at once is the slow part. pretty-mermaid is a 2k-star agent skill built on its README's one-line promise: turn Mermaid source into polished SVGs, shareable PNGs, and terminal-ready ASCII — locally, without a browser.
Why This Skill Matters
Most agent-drawn diagrams stop at whatever the default renderer produces. This skill renders one .mmd source three ways — polished SVG for docs, PNG for sharing, and ASCII/Unicode for terminals. The PNG is rendered directly in Node.js with no external converter, and the README is explicit that rendering happens locally without Chromium, Puppeteer, or a DOM.
Coverage is concrete. The SKILL.md maps each need to one of six diagram types, and --theme applies one of the 15 built-in themes:
| Need | Diagram type | Starter |
|---|---|---|
| Process, decision tree, architecture | Flowchart | flowchart LR |
| API calls, messages, interactions | Sequence | sequenceDiagram |
| Lifecycle or finite-state machine | State | stateDiagram-v2 |
| Classes, modules, relationships | Class | classDiagram |
| Database entities and cardinality | ER | erDiagram |
| Bars, lines, trends, comparisons | XY chart | xychart-beta |
The renderer also supports CJK state names, multiline labels, linkStyle, configurable ELK layout spacing, interactive XY chart tooltips, and ANSI-colored terminal output — all listed in the README.
Installation
npx skills add imxv/pretty-mermaid-skills@pretty-mermaid -g -y
Verify with npx skills list -g and confirm that pretty-mermaid appears in the global skill list. Node.js 16 or newer is required. The README's integration list names Claude Code, Cursor, Gemini CLI, Antigravity, OpenCode, Codex, and qoder, and its install section links to skills.sh to view the skill, install count, and security audits.
Real Workflow: One Release Architecture Diagram, Three Outputs
Say you maintain a billing service and release week is coming: the README needs an architecture picture, the announcement goes to chat, and the ops runbook is read in a terminal.
-
Install the skill, then hand the agent the request:
用 pretty-mermaid 给计费服务画一张流程图:客户端 → API 网关 → 计费服务 → Postgres, 支付失败时进入重试队列。源码保存为 .mmd 文件,然后出三份: tokyo-night 主题的 SVG 放进 README,1200 像素宽的 PNG 发到发布群, 再渲染一份终端可读的文本版本放进运维手册。 -
Per the SKILL.md workflow, the agent drafts the source. For unfamiliar syntax it starts from
assets/example_diagrams/— the repo ships six templates there, one per diagram type. The flowchart template reads:flowchart LR Start([Start]) --> Input[/Input Data/] Input --> Process[Process Data] Process --> Decision{Valid?} Decision -->|Yes| Success[Success] Decision -->|No| Error[Error Handler] Error --> Input Success --> End([End]) -
It renders with a named theme, inspects the result, fixes syntax, clipping, crowded layout, or unclear labels, and renders again — returning the source and output paths plus the selected format and theme. It will not overwrite an existing source or output file unless a replacement was requested. The bundled scripts run from the skill's own directory — SKILL.md calls it
<skill-root>— or via absolute paths, so the three renders look like this, with your own input and output paths:node scripts/render.mjs \ --input diagram.mmd \ --output diagram.svg \ --theme tokyo-nightnode scripts/render.mjs \ --input diagram.mmd \ --output diagram.png \ --format png \ --width 1200 \ --theme tokyo-nightnode scripts/render.mjs \ --input diagram.mmd \ --output diagram.txt \ --format ascii \ --color-mode noneAdd
--use-asciiwhen Unicode box-drawing characters are not acceptable, as the SKILL.md puts it.
Real Workflow: Batch-Render a Docs Directory
Diagrams multiply. SKILL.md: use batch rendering for three or more diagrams, or when consistent options must be applied to a directory:
node scripts/batch.mjs \
--input-dir ./diagrams \
--output-dir ./rendered \
--format svg \
--theme github-dark \
--workers 4
The README lists batch parallel rendering under High Performance, and the documented command sets --workers 4. Point --input-dir at your .mmd folder and the whole directory renders under one theme.
Tips
- Pick the theme by surface, from SKILL.md's own guide:
tokyo-nightfor general dark documentation,github-darkandgithub-lightfor GitHub dark or light surfaces,zinc-lightfor print and presentations,draculafor high-contrast color,nordandnord-lightfor a cool, restrained palette. To compare visually, the complete 15-theme gallery indocs/THEME_GALLERY.mdcompares the same flowchart across every built-in theme. - A named theme can be refined with explicit color flags:
--bgand--fgset the required base colors,--line,--accent, and--mutedrefine connectors, highlights, and secondary text,--surfaceand--borderrefine node fill and stroke, and--fontsets the SVG font family. --widthsets PNG output width from 100 to 10000 pixels while preserving aspect ratio.- Crowded SVG? The SKILL.md fix is to increase
--node-spacing,--layer-spacing, or--component-spacing. When authoring, useLRfor wide flows andTBfor narrow documents. --color-modeacceptsnone,auto,ansi16,ansi256,truecolor, orhtml; when redirected output shows terminal escape codes, the SKILL.md fix is--color-mode none.
When Not to Use This
The documented coverage is the six diagram types above; beyond that list the repo makes no promise, so check your diagram type against the assets/example_diagrams/ templates before building a pipeline on it. PNG export has a documented color caveat: custom colors need concrete hex values, because unresolved external CSS variables cannot be rasterized. And the SKILL.md tells agents to report any renderer limitation instead of silently dropping unsupported syntax, and to inspect visual output when layout matters — especially long labels, CJK text, disconnected components, and XY charts. Glance at the render before you ship it.
See the leaderboard for more skills.