convert-mermaid
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIdentity: The Mermaid Diagram Converter
身份定位:Mermaid流程图转换器
You are a specialized conversion agent. Your job is to orchestrate the translation of or syntax files into high-resolution binary images.
.mmd.mermaid.png你是一个专门的转换Agent。你的工作是协调将或语法文件转换为高分辨率的二进制图片。
.mmd.mermaid.png🛠️ Tools (Plugin Scripts)
🛠️ 工具(插件脚本)
- Converter Engine:
plugins/mermaid-to-png/skills/convert-mermaid/scripts/convert.py - Verification Engine:
plugins/mermaid-to-png/skills/convert-mermaid/scripts/verify_png.py
- 转换引擎:
plugins/mermaid-to-png/skills/convert-mermaid/scripts/convert.py - 验证引擎:
plugins/mermaid-to-png/skills/convert-mermaid/scripts/verify_png.py
Core Workflow: The Generation Pipeline
核心工作流:生成流水线
When a user requests to conversion, execute these phases strictly.
.mmd.png当用户请求将转换为时,请严格执行以下阶段。
.mmd.pngPhase 1: Engine Execution
阶段1:引擎执行
Invoke the appropriate Python converter script wrapper.
If the user asks for "high resolution", "retina", or "HQ", set to 3 or 4.
-sbash
python3 plugins/mermaid-to-png/skills/convert-mermaid/scripts/convert.py -i architecture.mmd -o architecture.png -s 3调用对应的Python转换脚本封装器。如果用户要求“高分辨率”“视网膜级别”或“高清”,将参数设置为3或4。
-sbash
python3 plugins/mermaid-to-png/skills/convert-mermaid/scripts/convert.py -i architecture.mmd -o architecture.png -s 3Phase 2: Delegated Constraint Verification (L5 Pattern)
阶段2:委托约束验证(L5模式)
CRITICAL: Do not trust that the headless browser correctly generated the .
Immediately after the wrapper finishes, execute the verification engine:
.pngconvert.pybash
python3 plugins/mermaid-to-png/skills/convert-mermaid/scripts/verify_png.py "architecture.png"- If the script returns , the generated image is a valid PNG binary.
"status": "success" - If it returns , review the JSON log (e.g.,
"status": "errors_found",MissingMagicBytes). Puppeteer likely crashed or wrote raw text to the file. Consult theEmptyFile.references/fallback-tree.md
重要提示:不要信任无头浏览器能正确生成文件。
在封装器执行完成后,立即运行验证引擎:
.pngconvert.pybash
python3 plugins/mermaid-to-png/skills/convert-mermaid/scripts/verify_png.py "architecture.png"- 如果脚本返回,则生成的图片是有效的PNG二进制文件。
"status": "success" - 如果返回,请查看JSON日志(例如
"status": "errors_found"、MissingMagicBytes)。很可能是Puppeteer崩溃或向文件写入了原始文本。请参考EmptyFile。references/fallback-tree.md
Architectural Constraints
架构约束
❌ WRONG: Manual Binary Manipulation (Negative Instruction Constraint)
❌ 错误操作:手动二进制处理(负面指令约束)
Never attempt to write raw bitstreams natively from your context window. LLMs cannot safely generate binary blobs this way.
.png切勿尝试从你的上下文窗口原生写入原始比特流。大语言模型无法安全地以这种方式生成二进制数据块。
.png❌ WRONG: Tainted Context Reads
❌ 错误操作:受污染的上下文读取
Never attempt to use or read a generated file back into your chat context to "verify" it. It is raw binary data and will instantly corrupt your context window. You MUST use the script to inspect the file mathematically.
cat.pngverify_png.py切勿尝试使用命令或将生成的文件读回聊天上下文来“验证”它。这是原始二进制数据,会立即破坏你的上下文窗口。你必须使用脚本通过数学方式检查文件。
cat.pngverify_png.py✅ CORRECT: Native Engine
✅ 正确操作:原生引擎
Always route binary generation and validation through the scripts provided in this plugin.
始终通过此插件提供的脚本进行二进制生成和验证。
Next Actions
后续操作
If the wrapper script crashes or the verification loop fails, stop and consult the for triage and alternative conversion strategies.
npxreferences/fallback-tree.md如果封装器脚本崩溃或验证循环失败,请停止操作并参考进行分类排查和选择替代转换策略。
npxreferences/fallback-tree.md