doc-mermaid-ascii
beautiful-mermaid
Render Mermaid diagrams to SVG or ASCII using the doc-mermaid-ascii npm package. Zero DOM dependencies, 15 built-in themes, works in Node.js/Bun without a browser.
Prerequisites
npm install beautiful-mermaid
# or
bun add beautiful-mermaid
Quick Render
Use the bundled render script for one-shot rendering:
# SVG output (default)
node ~/.claude/skills/beautiful-mermaid/scripts/render.mjs diagram.mmd -o diagram.svg
# ASCII output
node ~/.claude/skills/beautiful-mermaid/scripts/render.mjs diagram.mmd --ascii
# With theme
node ~/.claude/skills/beautiful-mermaid/scripts/render.mjs diagram.mmd -o diagram.svg --theme tokyo-night
# From inline text
node ~/.claude/skills/beautiful-mermaid/scripts/render.mjs --inline "graph LR; A --> B --> C" --ascii
# From stdin
echo "graph TD; A --> B" | node ~/.claude/skills/beautiful-mermaid/scripts/render.mjs --ascii
Programmatic API
SVG Rendering (async)
import { renderMermaid, THEMES } from 'beautiful-mermaid'
// Default (white bg, dark fg)
const svg = await renderMermaid('graph TD\n A --> B')
// With theme
const svg = await renderMermaid(diagram, THEMES['tokyo-night'])
// Custom colors (mono mode — just 2 colors)
const svg = await renderMermaid(diagram, { bg: '#1a1b26', fg: '#a9b1d6' })
// Enriched colors
const svg = await renderMermaid(diagram, {
bg: '#1a1b26', fg: '#a9b1d6',
line: '#3d59a1', accent: '#7aa2f7', muted: '#565f89',
})
ASCII Rendering (sync)
import { renderMermaidAscii } from 'beautiful-mermaid'
// Unicode box-drawing (default)
const text = renderMermaidAscii('graph LR\n A --> B --> C')
// ┌───┐ ┌───┐ ┌───┐
// │ A │────►│ B │────►│ C │
// └───┘ └───┘ └───┘
// Pure ASCII
const text = renderMermaidAscii('graph LR\n A --> B', { useAscii: true })
// +---+ +---+
// | A |---->| B |
// +---+ +---+
Supported Diagram Types
5 types (use the existing doc-mermaid skill's syntax references for full syntax):
| Type | Header | SVG | ASCII |
|---|---|---|---|
| Flowchart | graph TD / flowchart LR |
Yes | Yes |
| State | stateDiagram-v2 |
Yes | Yes |
| Sequence | sequenceDiagram |
Yes | Yes |
| Class | classDiagram |
Yes | Yes |
| ER | erDiagram |
Yes | Yes |
For C4, Gantt, timeline, user journey, mindmap, pie, git graph — use the doc-mermaid skill with mmdc instead.
Theming
See references/themes.md for the full theme catalog.
Mono Mode (2 colors)
Provide just bg and fg. All other colors auto-derive via color-mix():
- Text: fg at 100%
- Secondary text: fg at 60%
- Edge labels: fg at 40%
- Connectors: fg at 30%
- Arrow heads: fg at 50%
- Node fill: fg at 3%
- Node stroke: fg at 20%
Built-in Themes
import { THEMES } from 'beautiful-mermaid'
// THEMES['tokyo-night'], THEMES['dracula'], THEMES['github-dark'], etc.
15 themes: zinc-light, zinc-dark, tokyo-night, tokyo-night-storm, tokyo-night-light, catppuccin-mocha, catppuccin-latte, nord, nord-light, dracula, github-light, github-dark, solarized-light, solarized-dark, one-dark
Shiki VS Code Theme
import { fromShikiTheme } from 'beautiful-mermaid'
const colors = fromShikiTheme(shikiHighlighter.getTheme('vitesse-dark'))
RenderOptions
| Option | Type | Default | Description |
|---|---|---|---|
bg |
string | #FFFFFF |
Background color |
fg |
string | #27272A |
Foreground/text color |
line |
string? | derived | Edge/connector color |
accent |
string? | derived | Arrow heads, highlights |
muted |
string? | derived | Secondary text, labels |
surface |
string? | derived | Node fill tint |
border |
string? | derived | Node stroke |
font |
string | Inter |
Font family |
padding |
number | 40 |
Canvas padding (px) |
nodeSpacing |
number | 24 |
Horizontal node spacing |
layerSpacing |
number | 40 |
Vertical layer spacing |
transparent |
boolean | false |
Transparent background |
AsciiRenderOptions
| Option | Type | Default | Description |
|---|---|---|---|
useAscii |
boolean | false |
ASCII chars vs Unicode box-drawing |
paddingX |
number | 5 |
Horizontal node spacing |
paddingY |
number | 5 |
Vertical node spacing |
boxBorderPadding |
number | 1 |
Padding inside node boxes |
When to Use This vs doc-mermaid Skill
| Need | Use |
|---|---|
| SVG/ASCII for flowchart, sequence, class, state, ER | doc-mermaid-ascii |
| C4, Gantt, timeline, journey, mindmap, pie, git graph | doc-mermaid (mmdc) |
| Terminal/ASCII output | doc-mermaid-ascii |
| Editor-themed diagrams (tokyo-night, dracula, etc.) | doc-mermaid-ascii |
| Server-side rendering without Puppeteer | doc-mermaid-ascii |
| Full Mermaid syntax compatibility | doc-mermaid (mmdc) |
More from molechowski/claude-skills
res-price-compare
Polish market product price comparison: 20+ shops, shipping costs, manufacturer vs seller warranty, B2B/statutory warranty analysis, stock status, distribution chain. Export TXT/XLSX/HTML. Use when: looking for a product to buy, price comparison, where to buy cheapest. Triggers: cena, porównaj, gdzie kupić, najtaniej, sklep, price compare, best price, kup, ile kosztuje.
36doc-vault-project
Manage multi-note research projects in Obsidian vault with phased subdirectory structure (concept, research, design, implementation). Scaffold new projects, add component notes, track status, link existing research, promote topics to projects. Use when: creating a project, adding to a project, checking project status, linking research to a project, promoting a research topic to a full project. Triggers: project init, project add, project status, project link, project promote, create project, new project.
35res-deep
Iterative multi-round deep research with structured analysis frameworks. Use for: deep research on a topic, compare X vs Y, landscape analysis, evaluate options for a decision, deep dive into a technology, comprehensive research with cross-referencing. Triggers: deep research, compare, landscape, evaluate, deep dive, comprehensive research, which is better, should we use.
35doc-daily-digest
Process Obsidian daily notes: classify raw URLs and loose ideas, fetch content (X tweets, GitHub repos, web pages), run deep research on ideas, create structured vault notes, replace raw items with wikilinks. Orchestrates doc-obsidian, res-x, and res-deep skills. Use when: processing daily note links, digesting saved URLs into notes, turning ideas into research, daily note cleanup. Triggers: daily digest, process daily, daily links, triage daily, digest daily note.
35res-x
Fetch X/Twitter tweet content by URL and search X posts. Resolves tweet links that WebFetch cannot scrape. Use for: reading saved X/Twitter links, fetching tweet content from URLs, searching X for posts on a topic, batch-processing X links from notes. Triggers: x.com link, twitter.com link, fetch tweet, read tweet, what does this tweet say, X search, twitter search.
34doc-project
Update all project documentation in one pass: CLAUDE.md, AGENTS.md, README.md, SKILLS.md, CHANGELOG.md. Orchestrates doc-claude-md, doc-readme, doc-skills-md, and doc-changelog skills sequentially. Use when: project docs are stale, after major changes, initial project setup, sync all docs. Triggers: update all docs, update project docs, sync documentation, refresh docs, doc-project.
34