mermaid

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mermaid Skill

Mermaid Skill

Use this skill to quickly validate Mermaid diagrams by parsing + rendering them with the official Mermaid CLI.
使用该Skill可通过官方Mermaid CLI解析并渲染图表,快速验证Mermaid图。

Prerequisites

前提条件

  • Node.js + npm (for
    npx
    ).
  • First run downloads a headless Chromium via Puppeteer. If Chromium is missing, set
    PUPPETEER_EXECUTABLE_PATH
    .
  • Node.js + npm(用于
    npx
    )。
  • 首次运行会通过Puppeteer下载无头Chromium。如果Chromium缺失,请设置
    PUPPETEER_EXECUTABLE_PATH
    环境变量。

Tool

工具

Validate a diagram

验证图表

bash
./tools/validate.sh diagram.mmd [output.svg]
  • Parses and renders the Mermaid source.
  • Non-zero exit = invalid Mermaid syntax.
  • Prints an ASCII preview using
    beautiful-mermaid
    (best-effort; not all diagram types are supported).
  • If
    output.svg
    is omitted, the SVG is rendered to a temp file and discarded.
bash
./tools/validate.sh diagram.mmd [output.svg]
  • 解析并渲染Mermaid源码。
  • 非零退出码表示Mermaid语法无效。
  • 使用
    beautiful-mermaid
    打印ASCII预览(尽最大努力支持;并非所有图表类型都兼容)。
  • 如果省略
    output.svg
    ,SVG会渲染到临时文件并随后丢弃。

Workflow (short)

简短工作流程

  1. If the diagram will live in Markdown: draft it in a standalone
    diagram.mmd
    first (the tool only validates plain Mermaid files).
  2. Write/update
    diagram.mmd
    .
  3. Run
    ./tools/validate.sh diagram.mmd
    .
  4. Fix any errors shown by the CLI.
  5. Once it validates, copy the Mermaid block into your Markdown file.
  1. 如果图表将嵌入Markdown中:先在独立的
    diagram.mmd
    文件中起草(该工具仅验证纯Mermaid文件)。
  2. 编写/更新
    diagram.mmd
  3. 运行
    ./tools/validate.sh diagram.mmd
  4. 修复CLI提示的所有错误。
  5. 验证通过后,将Mermaid代码块复制到你的Markdown文件中。