重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/zc277584121/marketing-skills --skill mermaid-to-gif将 Mermaid 图表转换为具有丰富动画效果的动态 GIF。支持 .mmd 文件以及从 .md 文件中提取 ````mermaid` 代码块。
前提条件 : FFmpeg, Python 3.8+, Playwright (
pip install playwright && playwright install chromium)
.mmd 文件或包含 mermaid 代码块的 .md 文件重要提示 : 当从 .md 文件转换 mermaid 代码块时,请阅读周围的 Markdown 上下文,为每个图表选择最合适的动画样式。切勿盲目地对所有代码块应用相同的样式。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 上下文线索 | 推荐样式 | 理由 |
|---|---|---|
| 数据管道、ETL 流程、请求/响应路径 | pulse-flow | 流动的虚线传达数据移动 |
| 架构层、组织结构图、层级结构 | progressive | 元素逐层激活 |
| 分步流程、教程演练 | highlight-walk | 聚光灯引导读者完成每个步骤 |
| 系统概览、标题图、简单参考 | wave | 亮度涟漪增添活力而不分散注意力 |
| 带有消息流的序列图 | progressive | 消息按对话顺序逐一激活 |
| 类图/ER 图(参考/静态) | progressive 或 wave | 结构点亮或获得微妙的涟漪效果 |
* 如果周围文本提到"数据从 A 流向 B",即使对于简单的流程图也使用 `pulse-flow`
* 如果文本描述"三层"或"两层",使用 `progressive` 来逐层激活
* 如果图表是装饰性或补充性的,使用 `wave` 以保持简洁
* 对于非常大或复杂的图表,优先使用 `wave` 或较短的 `--duration` 以保持 GIF 文件大小合理
4. 逐块样式覆盖 : 当批量处理 .md 文件时,您可能需要使用不同的样式多次运行脚本,提取特定的代码块。或者使用合理的默认设置处理整个文件,然后重新处理需要不同样式的个别代码块。
## 数据摄取管道 ← 上下文:"管道" → pulse-flow
[mermaid 代码块:包含 ETL 阶段的 graph LR]
## 系统架构 ← 上下文:"架构" → progressive
[mermaid 代码块:包含层的 graph TD]
## 快速参考 ← 上下文:"参考" → wave
[mermaid 代码块:简单图表]
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py document.md -o ./images/
这将提取所有 ````mermaid` 代码块,并为每个代码块生成一个 GIF。
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py *.mmd -o ./gifs/
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py doc1.md doc2.md -o ./gifs/
生成 GIF 后,将原始的 ````mermaid` 代码块替换为图片引用:

根据图表内容使用描述性的替代文本。图片路径应相对于 Markdown 文件。
所有样式都保持图表从第 1 帧开始完全可见 — 没有元素从隐藏状态开始或从零淡入。每种样式都在用户始终能看到完整图表结构的同时添加了动态效果。
| 样式 | 效果 | 最适合 |
|---|---|---|
progressive (默认) | 所有元素以暗淡状态(25% 不透明度)开始,按顺序激活至完全亮度;边缘通过描边动画绘制 | 流程图、架构图、层级图 |
highlight-walk | 所有元素以暗淡状态(15% 不透明度)开始;一个带有蓝色光晕的聚光灯依次移动到每个元素,使访问过的元素保持明亮 | 分步流程、教程 |
pulse-flow | 所有元素完全可见;边缘变为流动的虚线(统一的虚线大小和速度) | 数据流、管道、请求路径 |
wave | 所有元素完全可见;一个亮度脉冲 + 蓝色光晕涟漪依次扫过元素 | 简单图表、概览图、参考图 |
| 标志 | 默认值 | 描述 |
|---|---|---|
-o, --output-dir | 与输入相同 | 生成的 GIF 的输出目录 |
-s, --style | progressive | 动画样式(见上表) |
--fps | 10 | 每秒帧数 |
--duration | 4.0 | 动画持续时间(秒) |
--hold | 1.0 | 循环前保持最后一帧的时间(秒) |
--theme | default | Mermaid 主题:default, dark, forest, neutral |
--bg | #ffffff | 背景颜色(十六进制) |
--padding | 40 | 图表周围的填充(像素) |
--scale | 2 | 渲染缩放因子(2 = 视网膜质量) |
--custom-css | — | 自定义 CSS 文件路径 |
--no-loop | — | GIF 播放一次而不是循环 |
# 深色主题,动画更快
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py arch.mmd --theme dark --bg "#1a1a2e" --duration 3
# 高 FPS 以获得更流畅的动画
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py flow.mmd --fps 15 --duration 5
# 批量转换文档中的所有 mermaid 代码块
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py README.md -o ./images/
# 自定义 CSS 以实现特殊效果
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd --custom-css my-style.css
# 不循环,适合一次性播放
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py intro.mmd --no-loop --duration 6
# 较低分辨率以获得更小的文件大小
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd --scale 1
创建一个 CSS 文件来自定义动画期间图表的外观:
/* 带阴影的圆角节点 */
.node rect {
rx: 10;
filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}
/* 更粗的边缘线 */
.edgePath path {
stroke-width: 2.5;
}
/* 参与者(序列图)的自定义背景 */
.actor {
fill: #e8f4f8;
}
通过 --custom-css 传递:
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd --custom-css my-style.css
.mmd 或 .md 文件中提取 Mermaid 代码setProgress(t) 用于逐帧控制(t: 0→1)。元素被收集、按位置排序(遵循 LR/TB 方向),并按交错的节点-边顺序进行动画处理--scale 1 以获得更小的文件--scale 1,或使用 wave 样式每周安装次数
112
代码仓库
首次出现
9 天前
安全审计
安装于
mcpjam112
antigravity112
kilo112
replit112
junie112
windsurf112
Convert Mermaid diagrams into animated GIFs with rich animation effects. Supports .mmd files and extracting ````mermaidcode blocks from.md` files.
Prerequisites : FFmpeg, Python 3.8+, Playwright (
pip install playwright && playwright install chromium)
.mmd files or .md files containing mermaid code blocksIMPORTANT : When converting mermaid blocks from .md files, read the surrounding markdown context to choose the most appropriate animation style for each diagram. Do NOT blindly apply the same style to all blocks.
| Context Clue | Recommended Style | Reasoning |
|---|---|---|
| Data pipeline, ETL flow, request/response path | pulse-flow | Flowing dashed lines convey data movement |
| Architecture layers, org chart, hierarchy | progressive | Elements activate layer-by-layer |
| Step-by-step process, tutorial walkthrough | highlight-walk | Spotlight guides the reader through each step |
| System overview, title diagram, simple reference | wave | Brightness ripple adds life without distraction |
| Sequence diagram with message flow | progressive |
Consider special handling :
pulse-flow even for a simple flowchartprogressive to activate layer-by-layerwave to keep it simplewave or shorter --duration to keep GIF size reasonablePer-block style override : When batch-processing a .md file, you may need to run the script multiple times with different styles, extracting specific blocks. Or process the whole file with a sensible default and re-run individual blocks that need different treatment.
## Data Ingestion Pipeline ← context: "pipeline" → pulse-flow
[mermaid block: graph LR with ETL stages]
## System Architecture ← context: "architecture" → progressive
[mermaid block: graph TD with layers]
## Quick Reference ← context: "reference" → wave
[mermaid block: simple diagram]
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py document.md -o ./images/
This extracts all ````mermaid` code blocks and generates one GIF per block.
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py *.mmd -o ./gifs/
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py doc1.md doc2.md -o ./gifs/
After generating GIFs, replace the original ````mermaid` code blocks with image references:

Use descriptive alt text based on the diagram content. The image path should be relative to the markdown file.
All styles keep the diagram fully visible from frame 1 — no elements start hidden or fade in from zero. Every style adds motion while the user can see the complete diagram structure at all times.
| Style | Effect | Best For |
|---|---|---|
progressive (default) | All elements start dimmed (25% opacity), activate sequentially to full brightness; edges draw in with stroke animation | Flowcharts, architecture, hierarchy |
highlight-walk | All elements start dimmed (15%); a spotlight with blue glow moves through each element, leaving visited ones bright | Step-by-step process, tutorials |
pulse-flow | All elements fully visible; edges become flowing dashed lines (uniform dash size and speed) | Data flow, pipelines, request paths |
wave | All elements fully visible; a brightness pulse + blue glow ripple sweeps through elements sequentially | Simple diagrams, overviews, reference |
| Flag | Default | Description |
|---|---|---|
-o, --output-dir | Same as input | Output directory for generated GIFs |
-s, --style | progressive | Animation style (see table above) |
--fps | 10 | Frames per second |
# Dark theme with faster animation
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py arch.mmd --theme dark --bg "#1a1a2e" --duration 3
# High FPS for smoother animation
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py flow.mmd --fps 15 --duration 5
# Batch convert all mermaid blocks from a doc
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py README.md -o ./images/
# Custom CSS for special effects
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd --custom-css my-style.css
# No loop, suitable for one-time playback
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py intro.mmd --no-loop --duration 6
# Lower resolution for smaller file size
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd --scale 1
Create a CSS file to customize the appearance of the diagram during animation:
/* Rounded nodes with shadow */
.node rect {
rx: 10;
filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}
/* Thicker edge lines */
.edgePath path {
stroke-width: 2.5;
}
/* Custom background for actors (sequence diagram) */
.actor {
fill: #e8f4f8;
}
Pass it via --custom-css:
python ${CLAUDE_SKILL_ROOT}/scripts/mermaid_to_gif.py diagram.mmd --custom-css my-style.css
.mmd or .md filessetProgress(t) for frame-by-frame control (t: 0→1). Elements are collected, sorted by position (respecting LR/TB direction), and animated in interleaved node-edge order--scale 1 for smaller files--scale 1, or use wave styleWeekly Installs
112
Repository
First Seen
9 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
mcpjam112
antigravity112
kilo112
replit112
junie112
windsurf112
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
48,700 周安装
Godot Engine开发指南:GDScript与资源文件(.tscn/.tres)高效协作技巧
58 周安装
安全重构指南:QA 重构技能详解,提升代码可维护性与交付速度
82 周安装
Python后端开发专家指南:Django与FastAPI最佳实践、数据库迁移与HTMX整合
80 周安装
Python异步代码顾问 - 检测竞态条件、死锁和性能问题 | asyncio/aiohttp/FastAPI
82 周安装
AI学习路径生成器 - 自动化课程开发与项目评估工具,提升教育科技效率
82 周安装
dbg 调试器:支持 Node.js、Bun 和原生代码(C/C++/Rust/Swift)的 CLI 调试工具
80 周安装
| Messages activate one by one in conversation order |
| Class/ER diagram (reference/static) | progressive or wave | Structure lights up or gets a subtle ripple |
--duration | 4.0 | Animation duration in seconds |
--hold | 1.0 | Hold last frame before looping (seconds) |
--theme | default | Mermaid theme: default, dark, forest, neutral |
--bg | #ffffff | Background color (hex) |
--padding | 40 | Padding around diagram in pixels |
--scale | 2 | Render scale factor (2 = retina quality) |
--custom-css | — | Path to custom CSS file |
--no-loop | — | Play GIF once instead of looping |