Skip to content

Add diagram skill with Mermaid, PlantUML, and Graphviz support - #8

Open
ZihengXiong wants to merge 1 commit into
felinics:mainfrom
ZihengXiong:add-diagram-skill
Open

Add diagram skill with Mermaid, PlantUML, and Graphviz support#8
ZihengXiong wants to merge 1 commit into
felinics:mainfrom
ZihengXiong:add-diagram-skill

Conversation

@ZihengXiong

Copy link
Copy Markdown
Contributor

What changed

Added a new diagram skill with support for Mermaid, PlantUML, and Graphviz.

This includes:

  • SKILL.md: entry point with tool-selection guide and quick-start flowchart
  • mermaid.md: reference for diagram types, theming, and common pitfalls
  • plantuml.md: examples for use case, component, deployment, activity, and state diagrams
  • graphviz.md: DOT syntax, layout engines, clusters, and HTML labels
  • scripts/render.py: unified renderer that auto-detects the input format

Why

This skill helps users generate and render diagrams more easily by providing structured guidance and examples for common diagram tools.

Testing

Checked that the new skill files are included and that the renderer supports Mermaid, PlantUML, and Graphviz inputs.

For PlantUML, the renderer falls back to the online API when plantuml.jar is not available.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new diagram skill to the skills library, providing reference documentation for Mermaid/PlantUML/Graphviz and a unified Python renderer script to convert diagram source files into PNG/SVG outputs.

Changes:

  • Added skills/diagram/SKILL.md as the entry point with tool-selection guidance and rendering examples.
  • Added large reference docs for Mermaid, PlantUML, and Graphviz to help users author diagram source.
  • Added skills/diagram/scripts/render.py to auto-detect .mmd/.puml/.dot inputs and render via Mermaid CLI, local PlantUML jar / online PlantUML server fallback, or Graphviz.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
skills/diagram/SKILL.md Skill entry point with selection guide and quick-start example.
skills/diagram/scripts/render.py CLI renderer for Mermaid/PlantUML/Graphviz inputs.
skills/diagram/mermaid.md Mermaid syntax reference and examples.
skills/diagram/plantuml.md PlantUML reference and rendering guidance.
skills/diagram/graphviz.md Graphviz DOT reference and rendering guidance.
Comments suppressed due to low confidence (2)

skills/diagram/plantuml.md:17

  • Many fenced code blocks use a Windows file path as the info string (e.g., ```F:\supermarket...); Markdown will treat this as a language tag, causing incorrect rendering and no syntax highlighting. Replace these with appropriate fence languages (e.g., bash/plantuml/json/text) and remove machine-specific absolute paths throughout the document.
```F:\supermarket\skills\diagram\plantuml.md#L1-1
# 输出 PNG(默认)
java -jar plantuml.jar input.puml

# 输出 SVG

skills/diagram/graphviz.md:1092

  • This fenced code block uses a Windows file path as the info string (```F:\supermarket...), which will render poorly in Markdown. Use an appropriate language tag (e.g., mermaid/text) and avoid machine-specific absolute paths.
```F:\supermarket\skills\diagram\graphviz.md#L1-1
flowchart LR
    A[用户请求] --> B{认证通过?}
    B -->|是| C[处理请求]
    B -->|否| D[返回 401]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +68 to +70

# 指定 PlantUML JAR 路径
python scripts/render.py input.puml output.png --jar /path/to/plantuml.jar
args = parser.parse_args()

input_path = Path(args.input)
output_path = Path(args.output)
Comment on lines +77 to +81
# Fall back to online API
encoded = _plantuml_encode(input_path.read_text(encoding="utf-8"))
url = f"https://www.plantuml.com/plantuml/{ext}/{encoded}"
print(f"No plantuml.jar found — using online API: {url}")
urllib.request.urlretrieve(url, output_path)
Comment on lines +1 to +4
# PlantUML Reference

PlantUML 是一套用纯文本描述 UML 及多种软件图形的工具,支持序列图、类图、用例图、组件图、部署图、活动图、状态图等。本文是 diagram skill 的 PlantUML 深度参考文档。

Comment on lines +1 to +4
# Graphviz Reference

Graphviz 是一套开源图形可视化工具,使用 DOT 语言描述图结构,通过多种布局引擎生成有向图、无向图、层次图、网络图等。本文是 diagram skill 的 Graphviz DOT 深度参考文档。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants