beautiful-mermaid by intellectronica/agent-skills
npx skills add https://github.com/intellectronica/agent-skills --skill beautiful-mermaid使用 Beautiful Mermaid 库将 Mermaid 图表渲染为 SVG 和 PNG 图像。
此技能需要 agent-browser 技能进行 PNG 渲染。在开始 PNG 截图前请先加载它。
Default, Dracula, Solarized, Zinc Dark, Tokyo Night, Tokyo Night Storm, Tokyo Night Light, Catppuccin Latte, Nord, Nord Light, GitHub Dark, GitHub Light, One Dark。
如果未指定主题,则使用 default。
使用管道语法表示边标签:
A -->|label| B
A ---|label| B
避免使用空格-破折号语法,这可能导致渲染不完整:
A -- label --> B # 可能导致问题
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
将包含特殊字符的标签用引号括起来:
A["Label with (parens)"]
B["Label with / slash"]
如果用户提供的是描述而非代码,请生成有效的 Mermaid 语法。完整语法细节请参考 references/mermaid-syntax.md。
运行渲染脚本生成 SVG 文件:
bun run scripts/render.ts --code "graph TD; A-->B" --output diagram --theme default
或从文件读取:
bun run scripts/render.ts --input diagram.mmd --output diagram --theme tokyo-night
替代运行时:
npx tsx scripts/render.ts --code "..." --output diagram
deno run --allow-read --allow-write --allow-net scripts/render.ts --code "..." --output diagram
这会在当前工作目录中生成 <output>.svg。
运行 HTML 包装器脚本为截图做准备:
bun run scripts/create-html.ts --svg diagram.svg --output diagram.html
这将创建一个最小化的 HTML 文件,以适当的边距和背景显示 SVG。
使用 agent-browser CLI 捕获高质量截图。完整的 CLI 文档请参考 agent-browser 技能。
# 设置 4K 视口以进行高分辨率捕获
agent-browser set viewport 3840 2160
# 打开 HTML 包装器
agent-browser open "file://$(pwd)/diagram.html"
# 等待渲染完成
agent-browser wait 1000
# 捕获全页截图
agent-browser screenshot --full diagram.png
# 关闭浏览器
agent-browser close
对于复杂图表需要更高分辨率时,可进一步增加视口大小,或在创建 HTML 包装器时使用 --padding 选项为图表提供更多空间。
渲染完成后,删除所有中间文件。只保留最终的 .svg 和 .png 文件。
需要清理的文件:
HTML 包装器文件(如 diagram.html)
为保存图表代码而创建的任何临时 .mmd 文件
渲染过程中创建的任何其他文件
rm diagram.html
如果创建了临时 .mmd 文件,也请将其删除。
始终生成两种输出:
文件将保存到当前工作目录,除非用户明确指定了不同的路径。
| 主题 | 背景 | 最佳用途 |
|---|---|---|
| default | 浅灰色 | 通用 |
| dracula | 深紫色 | 偏好深色模式 |
| tokyo-night | 深蓝色 | 现代深色美学 |
| tokyo-night-storm | 更深蓝色 | 更高对比度 |
| nord | 深北极色 | 柔和、平静的视觉效果 |
| nord-light | 浅北极色 | 柔和色调的浅色模式 |
| github-dark | GitHub 深色 | 匹配 GitHub UI |
| github-light | GitHub 浅色 | 匹配 GitHub UI |
| catppuccin-latte | 暖浅色 | 柔和粉彩色美学 |
| solarized | 棕褐色/奶油色 | Solarized 配色方案 |
| one-dark | Atom 深色 | Atom 编辑器美学 |
| zinc-dark | 中性深色 | 极简,无色彩偏见 |
检查渲染脚本输出的 bg 和 fg 值,或检查 SVG 开始标签中的 --bg 和 --fg CSS 自定义属性。
-->|label| 管道表示法,而非 -- label -->graph TD、graph LR 等)每周安装量
719
代码仓库
GitHub 星标数
228
首次出现时间
2026 年 1 月 29 日
安全审计
安装于
claude-code574
opencode507
gemini-cli499
codex493
github-copilot398
cursor374
Render Mermaid diagrams as SVG and PNG images using the Beautiful Mermaid library.
This skill requires the agent-browser skill for PNG rendering. Load it before proceeding with PNG capture.
Default, Dracula, Solarized, Zinc Dark, Tokyo Night, Tokyo Night Storm, Tokyo Night Light, Catppuccin Latte, Nord, Nord Light, GitHub Dark, GitHub Light, One Dark.
If no theme is specified, use default.
Use pipe syntax for edge labels:
A -->|label| B
A ---|label| B
Avoid space-dash syntax which can cause incomplete renders:
A -- label --> B # May cause issues
Wrap labels containing special characters in quotes:
A["Label with (parens)"]
B["Label with / slash"]
If the user provides a description rather than code, generate valid Mermaid syntax. Consult references/mermaid-syntax.md for full syntax details.
Run the rendering script to produce an SVG file:
bun run scripts/render.ts --code "graph TD; A-->B" --output diagram --theme default
Or from a file:
bun run scripts/render.ts --input diagram.mmd --output diagram --theme tokyo-night
Alternative runtimes:
npx tsx scripts/render.ts --code "..." --output diagram
deno run --allow-read --allow-write --allow-net scripts/render.ts --code "..." --output diagram
This produces <output>.svg in the current working directory.
Run the HTML wrapper script to prepare for screenshot:
bun run scripts/create-html.ts --svg diagram.svg --output diagram.html
This creates a minimal HTML file that displays the SVG with proper padding and background.
Use the agent-browser CLI to capture a high-quality screenshot. Refer to the agent-browser skill for full CLI documentation.
# Set 4K viewport for high-resolution capture
agent-browser set viewport 3840 2160
# Open the HTML wrapper
agent-browser open "file://$(pwd)/diagram.html"
# Wait for render to complete
agent-browser wait 1000
# Capture full-page screenshot
agent-browser screenshot --full diagram.png
# Close browser
agent-browser close
For even higher resolution on complex diagrams, increase the viewport further or use the --padding option when creating the HTML wrapper to give the diagram more space.
After rendering, remove all intermediary files. Only the final .svg and .png should remain.
Files to clean up:
The HTML wrapper file (e.g., diagram.html)
Any temporary .mmd files created to hold diagram code
Any other files created during the rendering process
rm diagram.html
If a temporary .mmd file was created, remove it as well.
Both outputs are always produced:
Files are saved to the current working directory unless the user explicitly specifies a different path.
| Theme | Background | Best For |
|---|---|---|
| default | Light grey | General use |
| dracula | Dark purple | Dark mode preference |
| tokyo-night | Dark blue | Modern dark aesthetic |
| tokyo-night-storm | Darker blue | Higher contrast |
| nord | Dark arctic | Muted, calm visuals |
| nord-light | Light arctic | Light mode with soft tones |
| github-dark | GitHub dark | Matches GitHub UI |
| github-light | GitHub light | Matches GitHub UI |
| catppuccin-latte | Warm light | Soft pastel aesthetic |
| solarized |
Check the render script output for the bg and fg values, or inspect the SVG's opening tag for --bg and --fg CSS custom properties.
-->|label| pipe notation, not -- label -->graph TD, graph LR, etc.)Weekly Installs
719
Repository
GitHub Stars
228
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
claude-code574
opencode507
gemini-cli499
codex493
github-copilot398
cursor374
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
企业级智能体运维指南:云端AI系统生命周期管理、可观测性与安全控制
657 周安装
Amazon Aurora DSQL 技能:无服务器分布式 SQL 数据库管理与 MCP 工具集成
SQL查询优化指南:PostgreSQL、Snowflake、BigQuery高性能SQL编写技巧与方言参考
657 周安装
Gemini Live API 开发指南:实时语音视频交互、WebSockets集成与SDK使用
657 周安装
WordPress渗透测试指南:WPScan工具使用与漏洞扫描实战教程
Excel MCP Server:通过Model Context Protocol实现227项Excel自动化操作指南
657 周安装
| Tan/cream |
| Solarized colour scheme |
| one-dark | Atom dark | Atom editor aesthetic |
| zinc-dark | Neutral dark | Minimal, no colour bias |