draw-io by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill draw-io.drawio 文件.drawio.png 文件.drawio.png对于在 Quarto 幻灯片中使用的图表,请在 mxGraphModel 标签中指定 defaultFontFamily:
<mxGraphModel defaultFontFamily="Noto Sans JP" ...>
同时,在每个文本元素的 style 属性中明确指定 fontFamily:
style="text;html=1;fontSize=27;fontFamily=Noto Sans JP;"
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
转换脚本位于 scripts/convert-drawio-to-png.sh。
# 转换所有 .drawio 文件
mise exec -- pre-commit run --all-files
# 转换特定的 .drawio 文件
mise exec -- pre-commit run convert-drawio-to-png --files assets/my-diagram.drawio
# 直接运行脚本(使用技能的脚本)
bash ~/.claude/skills/draw-io/scripts/convert-drawio-to-png.sh assets/diagram1.drawio
内部使用的命令:
drawio -x -f png -s 2 -t -o output.drawio.png input.drawio
| 选项 | 描述 |
|---|---|
-x | 导出模式 |
-f png | PNG 格式输出 |
-s 2 | 2 倍缩放(高分辨率) |
-t | 透明背景 |
-o | 输出文件路径 |
.drawio 文件(纯 XML 格式)mxCell(通过 value 属性搜索文本)mxGeometry 标签中调整坐标
x:距左侧的位置y:距顶部的位置width:宽度height:高度y + (height / 2)将复杂系统分解为分阶段的图表:
| 图表类型 | 目的 |
|---|---|
| 上下文图 | 从外部视角看系统概览 |
| 系统图 | 主要组件及其关系 |
| 组件图 | 技术细节和集成点 |
| 部署图 | 基础设施配置 |
| 数据流图 | 数据流和转换 |
| 序列图 | 时间序列交互 |
在图表中包含标题、描述、最后更新日期、作者和版本。
background="#ffffff"<!-- 对于 10 个字符的文本,预留 300-400px -->
<mxGeometry x="140" y="60" width="400" height="40" />
<!-- Title -->
<mxCell id="title" value="..." .../>
<!-- Arrows (back layer) -->
<mxCell id="arrow1" style="edgeStyle=..." .../>
<!-- Other elements (front layer) -->
<mxCell id="box1" .../>
对于文本元素,exitX/exitY 不起作用,因此使用显式坐标:
<!-- Good: Explicit coordinates with sourcePoint/targetPoint -->
<mxCell id="arrow" style="..." edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1279" y="500" as="sourcePoint"/>
<mxPoint x="119" y="500" as="targetPoint"/>
<Array as="points">
<mxPoint x="1279" y="560"/>
<mxPoint x="119" y="560"/>
</Array>
</mxGeometry>
</mxCell>
调整 offset 属性以使箭头标签远离箭头:
<!-- 放置在箭头上方(负值表示距离) -->
<mxPoint x="0" y="-40" as="offset"/>
<!-- 放置在箭头下方(正值表示距离) -->
<mxPoint x="0" y="40" as="offset"/>
<br> 标签进行换行将元素放置在背景框架(分组框)内时,确保有足够的边距。
rounded=1)和描边宽度坐标计算验证:
Background frame: y=20, height=400 -> range is y=20-420
Internal element top: frame y + 30 or more (e.g., y=50)
Internal element bottom: frame y + height - 30 or less (e.g., up to y=390)
错误示例(可能溢出):
<!-- Background frame -->
<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
<mxGeometry x="500" y="20" width="560" height="400" />
</mxCell>
<!-- Text: y=30 is too close to frame top (y=20) -->
<mxCell id="label" value="Title" style="text;...">
<mxGeometry x="510" y="30" width="540" height="35" />
</mxCell>
正确示例(足够的边距):
<!-- Background frame -->
<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
<mxGeometry x="500" y="20" width="560" height="430" />
</mxCell>
<!-- Text: y=50 is 30px from frame top (y=20) -->
<mxCell id="label" value="Title" style="text;...">
<mxGeometry x="510" y="50" width="540" height="35" />
</mxCell>
AWS 图标搜索示例:
python ~/.claude/skills/draw-io/scripts/find_aws_icon.py ec2
python ~/.claude/skills/draw-io/scripts/find_aws_icon.py lambda
在 YAML 头部添加 auto-stretch: false:
---
title: "Your Presentation"
format:
revealjs:
auto-stretch: false
---
这确保了在移动设备上正确显示图像。
每周安装次数
384
仓库
GitHub 星标数
22.6K
首次出现
Jan 25, 2026
安全审计
安装于
opencode305
gemini-cli276
codex274
claude-code266
github-copilot251
cursor246
.drawio files.drawio.png files.drawio.png by pre-commit hook in slidesFor diagrams used in Quarto slides, specify defaultFontFamily in mxGraphModel tag:
<mxGraphModel defaultFontFamily="Noto Sans JP" ...>
Also explicitly specify fontFamily in each text element's style attribute:
style="text;html=1;fontSize=27;fontFamily=Noto Sans JP;"
See conversion script at scripts/convert-drawio-to-png.sh.
# Convert all .drawio files
mise exec -- pre-commit run --all-files
# Convert specific .drawio file
mise exec -- pre-commit run convert-drawio-to-png --files assets/my-diagram.drawio
# Run script directly (using skill's script)
bash ~/.claude/skills/draw-io/scripts/convert-drawio-to-png.sh assets/diagram1.drawio
Internal command used:
drawio -x -f png -s 2 -t -o output.drawio.png input.drawio
| Option | Description |
|---|---|
-x | Export mode |
-f png | PNG format output |
-s 2 | 2x scale (high resolution) |
-t | Transparent background |
-o | Output file path |
.drawio file in text editor (plain XML format)mxCell for element to adjust (search by value attribute for text)mxGeometry tag
x: Position from lefty: Position from topwidth: Widthheight: Heighty + (height / 2)Separate complex systems into staged diagrams:
| Diagram Type | Purpose |
|---|---|
| Context Diagram | System overview from external perspective |
| System Diagram | Main components and relationships |
| Component Diagram | Technical details and integration points |
| Deployment Diagram | Infrastructure configuration |
| Data Flow Diagram | Data flow and transformation |
| Sequence Diagram | Time-series interactions |
Include title, description, last updated, author, and version in diagrams.
background="#ffffff"Allow 30-40px per character
Insufficient width causes unintended line breaks
<!-- For 10-character text, allow 300-400px --> <mxGeometry x="140" y="60" width="400" height="40" />Always place arrows at back (position in XML right after Title)
Position arrows to avoid overlapping with labels
Keep arrow start/end at least 20px from label bottom edge
<!-- Title --><mxCell id="title" value="..." .../>
<!-- Arrows (back layer) --><mxCell id="arrow1" style="edgeStyle=..." .../>
<!-- Other elements (front layer) --><mxCell id="box1" .../>
For text elements, exitX/exitY don't work, so use explicit coordinates:
<!-- Good: Explicit coordinates with sourcePoint/targetPoint -->
<mxCell id="arrow" style="..." edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1279" y="500" as="sourcePoint"/>
<mxPoint x="119" y="500" as="targetPoint"/>
<Array as="points">
<mxPoint x="1279" y="560"/>
<mxPoint x="119" y="560"/>
</Array>
</mxGeometry>
</mxCell>
Adjust offset attribute to distance arrow labels from arrows:
<!-- Place above arrow (negative value to distance) -->
<mxPoint x="0" y="-40" as="offset"/>
<!-- Place below arrow (positive value to distance) -->
<mxPoint x="0" y="40" as="offset"/>
<br> tag for line breaksWhen placing elements inside background frames (grouping boxes), ensure sufficient margin.
rounded=1) and stroke widthCoordinate calculation verification:
Background frame: y=20, height=400 -> range is y=20-420
Internal element top: frame y + 30 or more (e.g., y=50)
Internal element bottom: frame y + height - 30 or less (e.g., up to y=390)
Bad example (may overflow):
<!-- Background frame -->
<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
<mxGeometry x="500" y="20" width="560" height="400" />
</mxCell>
<!-- Text: y=30 is too close to frame top (y=20) -->
<mxCell id="label" value="Title" style="text;...">
<mxGeometry x="510" y="30" width="540" height="35" />
</mxCell>
Good example (sufficient margin):
<!-- Background frame -->
<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
<mxGeometry x="500" y="20" width="560" height="430" />
</mxCell>
<!-- Text: y=50 is 30px from frame top (y=20) -->
<mxCell id="label" value="Title" style="text;...">
<mxGeometry x="510" y="50" width="540" height="35" />
</mxCell>
AWS icon search examples:
python ~/.claude/skills/draw-io/scripts/find_aws_icon.py ec2
python ~/.claude/skills/draw-io/scripts/find_aws_icon.py lambda
Add auto-stretch: false to YAML header:
---
title: "Your Presentation"
format:
revealjs:
auto-stretch: false
---
This ensures correct image display on mobile devices.
Weekly Installs
384
Repository
GitHub Stars
22.6K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode305
gemini-cli276
codex274
claude-code266
github-copilot251
cursor246
前端设计技能指南:避免AI垃圾美学,打造独特生产级界面
33,100 周安装
Gemini CLI 更新日志自动化流程指南 | 技术文档版本管理最佳实践
430 周安装
tsdown - 基于Rolldown的极速TypeScript/JavaScript库打包工具,支持ESM/CJS/IIFE/UMD
430 周安装
PDF OCR技能:双引擎文字提取,支持影印PDF和图片识别
430 周安装
MUI v7 使用指南:组件样式、主题定制与响应式设计模式详解
431 周安装
HubSpot CRM 集成指南:使用 Membrane CLI 自动化销售、营销与客户服务
431 周安装
index-knowledge:自动生成层级化AGENTS.md文档工具,Turso数据库出品
431 周安装