Generate diagrams from Mermaid syntax. Uses a markdown-based flow, defaults to PNG, and requires double-quoted labels.
This skill allows the agent to generate diagrams (PNG, SVG, PDF) from Mermaid text syntax. It follows a robust workflow involving markdown files and verification.
Before executing any commands, the agent must:
mmdc is installed by running mmdc --version.A["Start"])..cursor/skills/draw-diagrams-with-mermaid/references/mermaid-syntax.md for compliant examples.The standard way to generate a diagram is to first create a markdown file containing the Mermaid block and then render it.
Create Markdown File: Write the Mermaid code into a .md file.
Render Diagram: Run the helper script to generate the image.
.cursor/skills/draw-diagrams-with-mermaid/scripts/draw-from-md.sh input.md [output.png]
output.svg, output.pdf) to change the format.Verify & Fix:
A["Start"], B{"Decision"}A[Start], B{Decision}assets/default-config.json or any other external configuration file unless explicitly asked. Rely on standard mmdc defaults.mmdc failure: Usually indicates a syntax error. Common issues:-> instead of --> in flowcharts).draw-from-md.sh script handles renaming logic if mmdc adds suffixes like -1.png. If it still fails, check permissions.logic.md (The file includes only this code block):graph TD
A["Input"] --> B{"Valid?"}
B -- "Yes" --> C["Process"]
B -- "No" --> D["Reject"]
Run Command:
.cursor/skills/draw-diagrams-with-mermaid/scripts/draw-from-md.sh logic.md
auth.md (The file includes only this code block):sequenceDiagram
User->>Server: "Login Request"
Server-->>User: "Auth Token"
.cursor/skills/draw-diagrams-with-mermaid/scripts/draw-from-md.sh auth.md auth-flow.svg