mermaid
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMermaid Diagram Renderer
Mermaid图表渲染工具
Render Mermaid diagrams using library. Supports 5 diagram types with dual output modes.
beautiful-mermaid使用库渲染Mermaid图表。支持5种图表类型,提供两种输出模式。
beautiful-mermaidQuick Start
快速开始
Dependencies () auto-install on first run.beautiful-mermaid
依赖项()会在首次运行时自动安装。beautiful-mermaid
SVG Output (Default)
SVG输出(默认)
bash
undefinedbash
undefinedFrom file
从文件读取
npx tsx scripts/render.ts diagram.mmd --output diagram.svg
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
undefinedecho "graph LR; A-->B-->C" | npx tsx scripts/render.ts --stdin --output flow.svg
undefinedASCII Output (Terminal)
ASCII输出(终端适配)
bash
undefinedbash
undefinedASCII art for terminal display
生成适合终端显示的ASCII艺术图
npx tsx scripts/render.ts diagram.mmd --ascii
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 │
└───────┘ └─────┘
undefinedecho "graph TD; Start-->End" | npx tsx scripts/render.ts --stdin --ascii
输出示例:
┌───────┐ ┌─────┐
│ Start │────▶│ End │
└───────┘ └─────┘
undefinedSupported Diagrams
支持的图表类型
| Type | Syntax | Best For |
|---|---|---|
| Flowchart | | Processes, decisions |
| Sequence | | API calls, interactions |
| State | | State machines |
| Class | | OOP design |
| ER | | Database schemas |
| 类型 | 语法格式 | 适用场景 |
|---|---|---|
| 流程图 | | 流程展示、决策逻辑 |
| 时序图 | | API调用、交互流程 |
| 状态图 | | 状态机模型 |
| 类图 | | 面向对象设计 |
| ER图 | | 数据库架构设计 |
Theming (SVG only)
主题设置(仅SVG支持)
bash
npx tsx scripts/render.ts diagram.mmd --theme github-dark --output out.svgUse invalid theme name to see available themes list (e.g., )
--theme ?bash
npx tsx scripts/render.ts diagram.mmd --theme github-dark --output out.svg使用无效的主题名称可查看可用主题列表(例如:)
--theme ?Resources
资源
- - Main rendering script
scripts/render.ts - - Mermaid syntax quick reference
references/syntax.md
- - 主渲染脚本
scripts/render.ts - - Mermaid语法速查手册
references/syntax.md