visualize
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/visualize
/visualize
Auto-detect content shape and render the appropriate visualization. Follows the active-selection rule from .
ai-workspace/rules/visualizations.md自动识别内容形态并渲染合适的可视化效果。遵循中的当前选择规则。
ai-workspace/rules/visualizations.mdUsage
使用方法
/visualize # visualize the last discussed concept
/visualize <topic or file> # visualize specific content
/visualize --format mermaid <topic> # force a specific format/visualize # 可视化最后讨论的概念
/visualize <topic or file> # 可视化特定内容
/visualize --format mermaid <topic> # 强制使用特定格式Steps
步骤
-
Identify content. From args, recent conversation context, or a file path. Determine what needs visualizing.
-
Classify content shape. Use this decision table:
Content shape Signal Format Graph with nodes + edges architecture, dependencies, flow between components Mermaid orgraphflowchartSequence / interaction request flow, API calls, multi-step protocol Mermaid sequenceDiagramState transitions modes, lifecycle, status changes Mermaid stateDiagram-v2Comparison (3+ items) options, tradeoffs, feature matrix Markdown table Hierarchy / tree file structure, org chart, simple nesting ASCII art Contrast (2 items) before/after, good/bad, do/don't Inline pairs Entity relationships data model, schema Mermaid erDiagram -
Check render surface. Mermaid in committedfiles renders on iOS/web/GitHub/VS Code. In terminal chunks, Mermaid is literal text — use ASCII instead. When surface is unknown, default to ASCII.
.md -
Render.
- ASCII / table / inline pairs: output directly in the response.
- Mermaid: output as a fenced code block in the response. If high-resolution PNG is needed:
mermaidbashnode --import tsx scripts/render-mermaid.ts --input <mermaid-file> --output <png-path> --width 2400 --height 1800 - Format override: if user passed , use that format regardless of auto-detection.
--format
-
Present. Show the visualization. If Mermaid PNG was rendered, display the path.
-
识别内容:从参数、最近的对话上下文或文件路径中获取。确定需要可视化的内容。
-
分类内容形态:使用以下决策表:
内容形态 特征 格式 带节点和边的图 架构、依赖关系、组件间流程 Mermaid 或graphflowchart序列/交互 请求流程、API调用、多步骤协议 Mermaid sequenceDiagram状态转换 模式、生命周期、状态变化 Mermaid stateDiagram-v2对比(3个及以上项) 选项、权衡、功能矩阵 Markdown表格 层级/树状 文件结构、组织结构图、简单嵌套 ASCII艺术图 对比(2个项) 前后对比、优劣对比、该做/不该做 内联配对 实体关系 数据模型、模式 Mermaid erDiagram -
检查渲染载体:提交的文件中的Mermaid可在iOS/网页/GitHub/VS Code中渲染。在终端块中,Mermaid是纯文本——改用ASCII格式。当载体未知时,默认使用ASCII。
.md -
渲染:
- ASCII/表格/内联配对:直接在响应中输出。
- Mermaid:在响应中输出为带围栏的代码块。如果需要高分辨率PNG:
mermaidbashnode --import tsx scripts/render-mermaid.ts --input <mermaid-file> --output <png-path> --width 2400 --height 1800 - 格式覆盖:如果用户传入参数,无论自动检测结果如何,都使用指定格式。
--format
-
呈现:展示可视化效果。如果渲染了Mermaid PNG,显示其路径。
Failure modes
失败场景
| Condition | Behavior |
|---|---|
| Content shape ambiguous | Ask: "This could be a [X] or [Y] — which fits better?" |
| Mermaid syntax error | Show the error, offer to fix |
| mmdc not available | Fall back to fenced Mermaid block (renders on GitHub/web) |
| 条件 | 行为 |
|---|---|
| 内容形态模糊 | 询问:“这可以渲染为[X]或[Y]——哪种更合适?” |
| Mermaid语法错误 | 显示错误信息,提供修复选项 |
| mmdc不可用 | 回退到带围栏的Mermaid代码块(可在GitHub/网页上渲染) |
Cross-tool notes
跨工具说明
- Codex / Cursor: run directly for PNG rendering. Content-shape detection is agent reasoning, not script logic.
scripts/render-mermaid.ts
- Codex / Cursor:直接运行来渲染PNG。内容形态检测是Agent推理逻辑,而非脚本逻辑。
scripts/render-mermaid.ts