Add diagram skill with Mermaid, PlantUML, and Graphviz support - #8
Open
ZihengXiong wants to merge 1 commit into
Open
Add diagram skill with Mermaid, PlantUML, and Graphviz support#8ZihengXiong wants to merge 1 commit into
ZihengXiong wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.mdas 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.pyto auto-detect.mmd/.puml/.dotinputs 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 深度参考文档。 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 flowchartmermaid.md: reference for diagram types, theming, and common pitfallsplantuml.md: examples for use case, component, deployment, activity, and state diagramsgraphviz.md: DOT syntax, layout engines, clusters, and HTML labelsscripts/render.py: unified renderer that auto-detects the input formatWhy
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.jaris not available.