技能 编程开发 Mermaid 图示渲染器

Mermaid 图示渲染器

v20260226
mermaid
使用 beautiful-mermaid 渲染 Mermaid 流程图、时序图、状态图、类图及实体关系图,可输出 SVG 或终端友好的 ASCII,并支持主题、文件或标准输入等多种用法。
获取技能
460 次下载
概览

Mermaid Diagram Renderer

Render Mermaid diagrams using beautiful-mermaid library. Supports 5 diagram types with dual output modes.

Quick Start

Dependencies (beautiful-mermaid) auto-install on first run.

SVG Output (Default)

# From file
npx tsx scripts/render.ts diagram.mmd --output diagram.svg

# From stdin
echo "graph LR; A-->B-->C" | npx tsx scripts/render.ts --stdin --output flow.svg

ASCII Output (Terminal)

# ASCII art for terminal display
npx tsx scripts/render.ts diagram.mmd --ascii

# Pipe directly
echo "graph TD; Start-->End" | npx tsx scripts/render.ts --stdin --ascii

Output example:

┌───────┐     ┌─────┐
│ Start │────▶│ End │
└───────┘     └─────┘

Supported Diagrams

Type Syntax Best For
Flowchart graph TD/LR Processes, decisions
Sequence sequenceDiagram API calls, interactions
State stateDiagram-v2 State machines
Class classDiagram OOP design
ER erDiagram Database schemas

Theming (SVG only)

npx tsx scripts/render.ts diagram.mmd --theme github-dark --output out.svg

Use invalid theme name to see available themes list (e.g., --theme ?)

Resources

  • scripts/render.ts - Main rendering script
  • references/syntax.md - Mermaid syntax quick reference
信息
Category 编程开发
Name mermaid
版本 v20260226
大小 3.38KB
更新时间 2026-02-27
语言