Loading...
Loading...
Compare original and translation side by side
.drawiohediet.vscode-drawio.drawiohediet.vscode-drawio.drawio.drawio.svg.drawio.png| Diagram Type | Template Available | Description |
|---|---|---|
| Flowchart | | Process flows with decisions and branches |
| System Architecture | | Multi-tier / layered service architecture |
| Sequence Diagram | | Actor lifelines and timed message flows |
| ER Diagram | | Database tables with relationships |
| UML Class Diagram | | Classes, interfaces, enums, relationships |
| Network Topology | (use shape library) | Routers, servers, firewalls, subnets |
| BPMN Workflow | (use shape library) | Business process events, tasks, gateways |
| Mind Map | (manual) | Central topic with radiating branches |
.drawio.drawio.svg.drawio.png| 图表类型 | 可用模板 | 说明 |
|---|---|---|
| 流程图 | | 包含判断和分支的流程走向图 |
| 系统架构图 | | 多层/分层服务架构图 |
| 时序图 | | 角色生命周期和带时序的消息流图 |
| ER图 | | 带关联关系的数据库表结构图 |
| UML类图 | | 类、接口、枚举及关联关系图 |
| 网络拓扑图 | (使用形状库) | 路由器、服务器、防火墙、子网结构图 |
| BPMN工作流图 | (使用形状库) | 业务流程事件、任务、网关图 |
| 思维导图 | (手动创建) | 中心主题向外辐射分支的结构图 |
hediet.vscode-drawioext install hediet.vscode-drawio.drawio.drawio.svg.drawio.pngscripts/hediet.vscode-drawioext install hediet.vscode-drawio.drawio.drawio.svg.drawio.pngscripts/.drawio.drawioassets/templates/<!-- Set modified="" to the current ISO 8601 timestamp when generating a new file -->
<mxfile host="Electron" modified="" version="26.0.0">
<diagram id="page-1" name="Page-1">
<mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1"
tooltips="1" connect="1" arrows="1" fold="1"
page="1" pageScale="1" pageWidth="1169" pageHeight="827"
math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Your cells go here -->
</root>
</mxGraphModel>
</diagram>
</mxfile>Rule: idsand0are ALWAYS required and must be the first two cells. Never reuse them.1
assets/templates/<!-- 生成新文件时请将modified=""设置为当前ISO 8601格式的时间戳 -->
<mxfile host="Electron" modified="" version="26.0.0">
<diagram id="page-1" name="Page-1">
<mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1"
tooltips="1" connect="1" arrows="1" fold="1"
page="1" pageScale="1" pageWidth="1169" pageHeight="827"
math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- 你的cell内容写在此处 -->
</root>
</mxGraphModel>
</diagram>
</mxfile>规则:id为和0的cell是必填项,必须作为前两个cell存在,不得重复使用。1
120x60160x801169 x 827120x60160x801169 x 827<mxCell id="unique-id" value="Label"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="100" y="100" width="120" height="60" as="geometry" />
</mxCell><mxCell id="edge-id" value="Label (optional)"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" source="source-id" target="target-id" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>mxGeometryxywidthheightas="geometry"sourcetargetsourcePointtargetPoint<mxGeometry>parenthtml=1<b><i><br>&&<<>><mxCell id="unique-id" value="Label"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="100" y="100" width="120" height="60" as="geometry" />
</mxCell><mxCell id="edge-id" value="Label (optional)"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" source="source-id" target="target-id" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>mxGeometryxywidthheightas="geometry"sourcetarget<mxGeometry>sourcePointtargetPointparent<b><i><br>html=1&&<<>>| Purpose | fillColor | strokeColor |
|---|---|---|
| Primary / Info | | |
| Success / Start | | |
| Warning / Decision | | |
| Error / End | | |
| Neutral | | |
| External / Partner | | |
undefined| 用途 | fillColor | strokeColor |
|---|---|---|
| 主要/信息 | | |
| 成功/开始 | | |
| 警告/判断 | | |
| 错误/结束 | | |
| 中性 | | |
| 外部/合作方 | | |
undefined
> See `references/style-reference.md` for the complete style key catalog and `references/shape-libraries.md` for all shape library names.
> 完整的样式键目录请查看`references/style-reference.md`,所有形状库名称请查看`references/shape-libraries.md`。.drawiopython .github/skills/draw-io-diagram-generator/scripts/validate-drawio.py <path-to-file.drawio>"Openin VS Code — it will render automatically with the draw.io extension. You can use draw.io's web app or desktop app as well if you prefer."<filename>
.drawiopython .github/skills/draw-io-diagram-generator/scripts/validate-drawio.py <path-to-file.drawio>"在VS Code中打开即可,draw.io扩展会自动渲染。你也可以根据偏好使用draw.io网页端或桌面端应用打开。"<filename>
<!-- Start node -->
<mxCell id="start" value="Start"
style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
vertex="1" parent="1">
<mxGeometry x="500" y="80" width="120" height="60" as="geometry" />
</mxCell>
<!-- Process -->
<mxCell id="p1" value="Process Step"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="500" y="200" width="120" height="60" as="geometry" />
</mxCell>
<!-- Decision -->
<mxCell id="d1" value="Condition?"
style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;"
vertex="1" parent="1">
<mxGeometry x="460" y="320" width="200" height="100" as="geometry" />
</mxCell>
<!-- Arrow: start to p1 -->
<mxCell id="e1" value=""
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" source="start" target="p1" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell><!-- 开始节点 -->
<mxCell id="start" value="Start"
style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
vertex="1" parent="1">
<mxGeometry x="500" y="80" width="120" height="60" as="geometry" />
</mxCell>
<!-- 流程节点 -->
<mxCell id="p1" value="Process Step"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="500" y="200" width="120" height="60" as="geometry" />
</mxCell>
<!-- 判断节点 -->
<mxCell id="d1" value="Condition?"
style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;"
vertex="1" parent="1">
<mxGeometry x="460" y="320" width="200" height="100" as="geometry" />
</mxCell>
<!-- 箭头:开始到流程节点p1 -->
<mxCell id="e1" value=""
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" source="start" target="p1" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell><!-- Tier swimlane -->
<mxCell id="tier1" value="Client Layer"
style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;"
vertex="1" parent="1">
<mxGeometry x="60" y="100" width="1050" height="130" as="geometry" />
</mxCell>
<!-- Service inside tier (parent="tier1", coords are relative to tier) -->
<mxCell id="webapp" value="Web App"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="tier1">
<mxGeometry x="80" y="40" width="120" height="60" as="geometry" />
</mxCell>Connectors between tiers use absolute coordinates with.parent="1"
<!-- 层级泳道 -->
<mxCell id="tier1" value="Client Layer"
style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;"
vertex="1" parent="1">
<mxGeometry x="60" y="100" width="1050" height="130" as="geometry" />
</mxCell>
<!-- 层级内的服务(parent="tier1",坐标相对于泳道) -->
<mxCell id="webapp" value="Web App"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="tier1">
<mxGeometry x="80" y="40" width="120" height="60" as="geometry" />
</mxCell>层级之间的连接线使用绝对坐标,。parent="1"
edge="1"endArrow=nonedashed=1sourcePointtargetPointendArrow=block;endFill=1endArrow=open;endFill=0;dashed=1<!-- Actor (stick figure) -->
<mxCell id="actorA" value="Client"
style="shape=mxgraph.uml.actor;pointerEvents=1;dashed=0;whiteSpace=wrap;html=1;aspect=fixed;"
vertex="1" parent="1">
<mxGeometry x="110" y="80" width="60" height="80" as="geometry" />
</mxCell>
<!-- Service box -->
<mxCell id="actorB" value="API Server"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;"
vertex="1" parent="1">
<mxGeometry x="480" y="100" width="160" height="60" as="geometry" />
</mxCell>
<!-- Lifeline — floating edge: uses sourcePoint/targetPoint, NOT source/target attributes -->
<mxCell id="lifA" value=""
style="edgeStyle=none;dashed=1;endArrow=none;"
edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="140" y="160" as="sourcePoint" />
<mxPoint x="140" y="700" as="targetPoint" />
</mxGeometry>
</mxCell>
<!-- Activation box (thin rectangle on lifeline) -->
<mxCell id="actA1" value=""
style="fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="130" y="220" width="20" height="180" as="geometry" />
</mxCell>
<!-- Synchronous message -->
<mxCell id="msg1" value="POST /orders"
style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;endArrow=block;endFill=1;"
edge="1" source="actA1" target="actorB" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Return message (dashed) -->
<mxCell id="msg2" value="201 Created"
style="edgeStyle=elbowEdgeStyle;elbow=vertical;dashed=1;html=1;endArrow=open;endFill=0;"
edge="1" source="actorB" target="actA1" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>Note: Lifelines are floating edges that use/sourcePointintargetPointinstead of<mxGeometry>/sourceattributes. This is the standard draw.io pattern for sequence diagrams.target
edge="1endArrow=nonedashed=1sourcePointtargetPointendArrow=block;endFill=1endArrow=open;endFill=0;dashed=1<!-- 角色(小人图标) -->
<mxCell id="actorA" value="Client"
style="shape=mxgraph.uml.actor;pointerEvents=1;dashed=0;whiteSpace=wrap;html=1;aspect=fixed;"
vertex="1" parent="1">
<mxGeometry x="110" y="80" width="60" height="80" as="geometry" />
</mxCell>
<!-- 服务框 -->
<mxCell id="actorB" value="API Server"
style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;"
vertex="1" parent="1">
<mxGeometry x="480" y="100" width="160" height="60" as="geometry" />
</mxCell>
<!-- 生命线 —— 浮动边:使用sourcePoint/targetPoint,而非source/target属性 -->
<mxCell id="lifA" value=""
style="edgeStyle=none;dashed=1;endArrow=none;"
edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="140" y="160" as="sourcePoint" />
<mxPoint x="140" y="700" as="targetPoint" />
</mxGeometry>
</mxCell>
<!-- 激活框(生命线上的瘦矩形) -->
<mxCell id="actA1" value=""
style="fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="130" y="220" width="20" height="180" as="geometry" />
</mxCell>
<!-- 同步消息 -->
<mxCell id="msg1" value="POST /orders"
style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;endArrow=block;endFill=1;"
edge="1" source="actA1" target="actorB" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- 返回消息(虚线) -->
<mxCell id="msg2" value="201 Created"
style="edgeStyle=elbowEdgeStyle;elbow=vertical;dashed=1;html=1;endArrow=open;endFill=0;"
edge="1" source="actorB" target="actA1" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>注意: 生命线是浮动边,在中使用<mxGeometry>/sourcePoint而非targetPoint/source属性,这是draw.io时序图的标准实现方式。target
shape=tablechildLayout=tableLayoutshape=tableRowportConstraint=eastwestshape=partialRectangleedgeStyle=entityRelationEdgeStylestartArrow=ERone;endArrow=ERonestartArrow=ERone;endArrow=ERmanystartArrow=ERmany;endArrow=ERmanyERmandOneERzeroToOneshape=tablechildLayout=tableLayoutshape=tableRowportConstraint=eastwestshape=partialRectangleedgeStyle=entityRelationEdgeStylestartArrow=ERone;endArrow=ERonestartArrow=ERone;endArrow=ERmanystartArrow=ERmany;endArrow=ERmanyERmandOneERzeroToOne| Relationship | Style String |
|---|---|
| Inheritance (extends) | |
| Realization (implements) | |
| Composition | |
| Aggregation | |
| Dependency | |
| Association | |
| 关联类型 | 样式字符串 |
|---|---|
| 继承(extends) | |
| 实现(implements) | |
| 组合 | |
| 聚合 | |
| 依赖 | |
| 关联 | |
<diagram><mxfile host="Electron" version="26.0.0">
<diagram id="overview" name="Overview">
<!-- overview mxGraphModel -->
</diagram>
<diagram id="detail" name="Detail View">
<!-- detail mxGraphModel -->
</diagram>
</mxfile><diagram><mxfile host="Electron" version="26.0.0">
<diagram id="overview" name="Overview">
<!-- 概览页的mxGraphModel -->
</diagram>
<diagram id="detail" name="Detail View">
<!-- 详情页的mxGraphModel -->
</diagram>
</mxfile>.drawionamescripts/add-shape.pypython .github/skills/draw-io-diagram-generator/scripts/add-shape.py docs/arch.drawio "New Service" 700 380.drawionamescripts/add-shape.pypython .github/skills/draw-io-diagram-generator/scripts/add-shape.py docs/arch.drawio "New Service" 700 380text;strokeColor=none;fillColor=none;fontSize=18;fontStyle=1whiteSpace=wrap;html=1edgeStyle=orthogonalEdgeStyleorder-service-flow.drawiodatabase-schema.drawiodocs/architecture/text;strokeColor=none;fillColor=none;fontSize=18;fontStyle=1whiteSpace=wrap;html=1edgeStyle=orthogonalEdgeStyleorder-service-flow.drawiodatabase-schema.drawiodocs/architecture/| Problem | Likely Cause | Fix |
|---|---|---|
| File opens blank in VS Code | Missing id=0 or id=1 cell | Add both root cells before any other cells |
| Shape at wrong position | Child inside container — coords are relative | Check |
| Edge not visible | source or target id does not match any vertex | Verify both ids exist exactly as written |
| Diagram shows "Compressed" | mxGraphModel is base64-encoded | Open in draw.io web, File > Export > XML (uncompressed) |
| Shape style not rendering | Typo in shape= name | Check |
| Label shows escaped HTML | html=0 on a cell with HTML label | Add |
| Container children overlap container edge | Container height too small | Increase container height in mxGeometry |
| 问题 | 可能原因 | 解决方法 |
|---|---|---|
| 文件在VS Code中打开为空白 | 缺少id=0或id=1的cell | 在所有其他cell之前添加这两个根cell |
| 形状位置错误 | 容器中的子元素坐标是相对值 | 检查 |
| 边不可见 | source或target id与现有顶点不匹配 | 确认两个id与现有值完全一致 |
| 图表显示"已压缩" | mxGraphModel是base64编码的 | 在draw.io网页端打开,文件>导出>XML(未压缩) |
| 形状样式不渲染 | shape=名称拼写错误 | 查看 |
| 标签显示转义后的HTML | 带HTML标签的cell的html=0 | 在cell样式中添加 |
| 容器子元素超出容器边缘 | 容器高度太小 | 增大mxGeometry中的容器高度 |
.drawio<mxfile><diagram>id<mxCell id="0" /><mxCell id="1" parent="0" />idvertex="1"<mxGeometry as="geometry">edge="1"sourcetarget<mxPoint as="sourcePoint"><mxPoint as="targetPoint"><mxGeometry>parenthtml=1&<>python .github/skills/draw-io-diagram-generator/scripts/validate-drawio.py <file.drawio>.drawio<mxfile><diagram>id<mxCell id="0" /><mxCell id="1" parent="0" />idvertex="1"<mxGeometry as="geometry">edge="1"sourcetarget<mxGeometry><mxPoint as="sourcePoint"><mxPoint as="targetPoint">parenthtml=1&<>python .github/skills/draw-io-diagram-generator/scripts/validate-drawio.py <file.drawio>.drawio"Openin VS Code — the draw.io extension will render it automatically. Or you can open it in the draw.io web app or desktop app if you prefer."<filename>
"Click any shape to select it. Double-click to edit the label. Drag to reposition."
.drawio"在VS Code中打开即可,draw.io扩展会自动渲染。你也可以根据偏好使用draw.io网页端或桌面端应用打开。"<filename>
"点击任意形状即可选中,双击可编辑标签,拖拽可调整位置。"
.github/skills/draw-io-diagram-generator/| File | Contents |
|---|---|
| Complete mxfile / mxGraphModel / mxCell attribute reference, coordinate system, reserved cells, validation rules |
| All style keys with allowed values, vertex and edge style keys, shape catalog, semantic color palette |
| All shape library categories (General, Flowchart, UML, ER, Network, BPMN, Mockup, K8s) with style strings |
| Ready-to-use flowchart template |
| 4-tier system architecture template |
| 3-actor sequence diagram template |
| 3-table ER diagram with crow's foot relationships |
| Interface + 2 classes + enum with relationship arrows |
| Python script to validate XML structure of any .drawio file |
| Python CLI to add a new shape to an existing diagram |
| How to use the scripts with examples |
.github/skills/draw-io-diagram-generator/| 文件 | 内容 |
|---|---|
| 完整的mxfile/mxGraphModel/mxCell属性参考、坐标系、保留cell、校验规则 |
| 所有样式键的允许值、顶点和边样式键、形状目录、语义化调色板 |
| 所有形状库分类(通用、流程图、UML、ER、网络、BPMN、原型、K8s)及对应的样式字符串 |
| 开箱即用的流程图模板 |
| 4层系统架构模板 |
| 3角色时序图模板 |
| 带乌鸦脚关联的3表ER图模板 |
| 接口+2个类+枚举带关联箭头的模板 |
| 校验任意.drawio文件XML结构的Python脚本 |
| 向现有图表添加新形状的Python CLI工具 |
| 脚本使用说明及示例 |
| ", |