SuperAPI AI Directory

enhanced-markdown

Agents & models

View repository

Updated 10-15 21:36

About this skill

Enhanced Markdown Output Skill

Make large model output fully leverage the rendering capabilities of the Markdown Viewer extension.

Core Principles

Human readability first — Choose the presentation that lets readers understand fastest, not the most showy one.


Rendering Capabilities Quick Reference

Capability Syntax Marker Best Scenario Complexity
Mermaid mermaid Processes, architecture, sequence, class diagrams ★☆☆
Vega-Lite vega-lite Data visualization, statistical charts ★★☆
Canvas canvas Mind maps, knowledge graphs ★★☆
DOT dot Complex relationships, dependency trees, state machines ★★☆
Infographic infographic Statistical charts, progress displays ★☆☆
LaTeX $...$ / $$...$$ Mathematical formulas, equations ★☆☆
Merged tables HTML colspan/rowspan Complex reports, rowspan and colspan ★☆☆
Inline HTML <tag> Style enhancement, colored labels ★☆☆

Not sure about the exact syntax? Go to ~/dev/ai/markdown-viewer-extension/docs/features/ to check the corresponding documentation.


Routing Decision Tree

内容类型判断
│
├─► 有数据要展示?
│   ├─ 时间序列/对比 → Vega-Lite 图表
│   ├─ 占比/分布 → Infographic 饼图/柱状图
│   └─ 简单统计 → 表格
│
├─► 有流程/步骤?
│   ├─ 线性流程 (A→B→C) → Mermaid flowchart LR
│   ├─ 复杂分支 (多条件判断) → Mermaid flowchart TD
│   ├─ 系统交互 → Mermaid sequenceDiagram
│   └─ 代码执行流程 → 代码块 + 注释
│
├─► 有架构/组件关系?
│   ├─ 简单层级 → Mermaid graph TD
│   ├─ 复杂拓扑 → DOT graph
│   ├─ 云服务架构 → drawio (如需要精确图标)
│   └─ 概念关联 → Canvas 思维导图
│
├─► 有数学/算法?
│   ├─ 行内公式 → `$E=mc^2$`
│   ├─ 方程组 → `$$...$$` 块
│   └─ 算法步骤 → 编号列表 + 关键行 LaTeX
│
└─► 纯文本内容?
    ├─ 重点突出 → HTML `<mark>`, `<span style="color:">`
    ├─ 状态标签 → HTML `<span style="background:">badge</span>`
    └─ 结构清晰 → 标准 Markdown 层级

Progressive Documentation Strategy (Full-Stack Development Edition)

Choose the complexity level based on the document's purpose and the reader's role:

Level Target Reader Document Form Diagram Density Example Scenario
L1-Draft Self/AI Quick notes 0% Requirement sorting, BUG records
L2-Discussion Team members Structured description 20% PRD review, technical solution discussion
L3-Delivery Cross-team collaboration Complete document + key diagrams 40% API documentation, deployment guide
L4-Archive Future maintainers Comprehensive visualization 60%+ Architecture documentation, operations manual

Progressive Determination Criteria

问题 → 回答 → 决策

是否需要快速迭代?
├─ 是 → L1-草稿(纯文本速记)
└─ 否 → 继续

是否需要多人讨论?
├─ 是 → L2-讨论(结构化+Mermaid流程)
└─ 否 → 继续

是否需要长期维护?
├─ 是 → L4-存档(完整图表+版本记录)
└─ 否 → L3-交付(关键路径可视化)

Programming Scenario Template Routing

Routing Overview

开发阶段 → 文档类型 → 推荐渲染方式

需求分析
├─ 用户故事 → 文本 + 验收清单
├─ 业务流程 → Mermaid flowchart
└─ 数据流图 → Mermaid sequenceDiagram

架构设计
├─ 系统架构 → Mermaid graph TB / drawio
├─ 模块关系 → DOT digraph
├─ ERD设计 → Mermaid erDiagram
└─ 技术选型 → 对比表格 + Infographic卡片

编码实现
├─ API设计 → Mermaid sequenceDiagram
├─ 状态机 → Mermaid stateDiagram
├─ 类图 → Mermaid classDiagram
└─ 错误处理 → Mermaid flowchart(异常分支标注红)

测试部署
├─ 测试策略 → DOT图(覆盖路径)
├─ CI/CD流程 → Mermaid flowchart LR
├─ 部署架构 → Mermaid graph TB
└─ 性能基准 → Vega-Lite对比图

运维监控
├─ 告警策略 → 表格 + 条件样式
├─ 故障处理 → Mermaid flowchart(决策树)
└─ 监控大屏 → Infographic仪表板

Scenario Template Library

1. API Response Description (L2-L3)

❌ Plain text description

接口先验证token,然后检查权限,最后返回数据

✅ Mermaid sequence diagram

sequenceDiagram
    Client->>+API: POST /data
    API->>+Auth: verify(token)
    Auth-->>-API: valid
    API->>+DB: query
    DB-->>-API: result
    API-->>-Client: 200 + data

2. Database ERD (L3-L4)

erDiagram
    USER ||--o{ ORDER : places
    USER {
        int id PK
        string email
        string name
    }
    ORDER {
        int id PK
        int user_id FK
        decimal total
        datetime created_at
    }

3. System Architecture Diagram (L3-L4)

graph TB
    subgraph Client
        A[React SPA]
        B[Mobile App]
    end
    subgraph Gateway
        C[NGINX]
        D[API Gateway]
    end
    subgraph Services
        E[Auth Service]
        F[Core API]
        G[Worker]
    end
    subgraph Data
        H[(PostgreSQL)]
        I[(Redis)]
        J[Object Storage]
    end
    
    A --> C
    B --> C
    C --> D
    D --> E
    D --> F
    F --> G
    F --> H
    F --> I
    G --> J

4. State Machine Design (L2-L3)

stateDiagram-v2
    [*] --> Draft
    Draft --> Pending: submit
    Pending --> Approved: approve
    Pending --> Rejected: reject
    Approved --> Published: publish
    Rejected --> Draft: revise
    Published --> Archived: archive
    Archived --> [*]

5. Error Handling Flow (L3-L4)

flowchart TD
    A[API调用] --> B{异常?}
    B -->|No| C[正常响应]
    B -->|Yes| D{异常类型}
    D -->|4xx| E[返回错误信息]
    D -->|5xx| F[记录日志]
    F --> G[返回500]
    D -->|Timeout| H[重试]
    H --> I{重试次数>3?}
    I -->|No| A
    I -->|Yes| J[熔断降级]
    
    style E fill:#ffebee
    style G fill:#ffebee
    style J fill:#fff3e0

6. CI/CD Deployment Flow (L3-L4)

flowchart LR
    A[Push] --> B[Build]
    B --> C[Test]
    C --> D{Pass?}
    D -->|Yes| E[Deploy Staging]
    D -->|No| F[Notify]
    E --> G[Integration Test]
    G --> H{Pass?}
    H -->|Yes| I[Deploy Prod]
    H -->|No| F
    I --> J[Done]

7. Technology Selection Comparison (L2-L3)

Option Performance Ecosystem Learning Cost Maintenance Cost Recommendation
A: React ★★★★☆ ★★★★★ ★★★☆☆ ★★★★☆ Preferred
B: Vue ★★★★☆ ★★★★☆ ★★★★☆ ★★★★★ Backup
C: Svelte ★★★★★ ★★★☆☆ ★★★★★ ★★★☆☆ Watch

8. Performance Benchmark Comparison (L3-L4)

{
  "data": {"values": [
    {"framework": "React", "ops": 45000, "memory": 45},
    {"framework": "Vue", "ops": 52000, "memory": 38},
    {"framework": "Svelte", "ops": 68000, "memory": 28},
    {"framework": "Solid", "ops": 72000, "memory": 25}
  ]},
  "encoding": {
    "x": {"field": "framework", "type": "ordinal"},
    "y": {"field": "ops", "type": "quantitative", "title": "ops/sec"}
  },
  "layer": [
    {"mark": "bar", "encoding": {"color": {"value": "#4a90d9"}}},
    {"mark": {"type": "text", "dy": -5}, "encoding": {"text": {"field": "ops"}}}
  ]
}

9. Frontend Component Hierarchy (L2-L3)

graph TD
    App --> Layout
    Layout --> Header
    Layout --> Sidebar
    Layout --> Main
    Main --> PageContainer
    PageContainer --> Table
    PageContainer --> Form
    Table --> Pagination
    Table --> FilterBar
    Form --> Input
    Form --> Select
    Form --> Button

10. API Route Table (L3-L4)

<table>
  <tr>
    <th>Method</th>
    <th>Path</th>
    <th>Auth</th>
    <th>Rate Limit</th>
    <th>描述</th>
  </tr>
  <tr>
    <td><span style="background:#4caf50;color:white;padding:2px 6px;border-radius:3px;">GET</span></td>
    <td><code>/api/users</code></td>
    <td>✓</td>
    <td>100/min</td>
    <td>列表查询</td>
  </tr>
  <tr>
    <td><span style="background:#2196f3;color:white;padding:2px 6px;border-radius:3px;">POST</span></td>
    <td><code>/api/users</code></td>
    <td>✓</td>
    <td>10/min</td>
    <td>创建用户</td>
  </tr>
  <tr>
    <td><span style="background:#ff9800;color:white;padding:2px 6px;border-radius:3px;">PATCH</span></td>
    <td><code>/api/users/:id</code></td>
    <td>✓ Admin</td>
    <td>20/min</td>
    <td>部分更新</td>
  </tr>
</table>

11. Module Dependency Description (L2-L3)

❌ Text listing

A依赖B和C,B依赖D,C依赖D和E

✅ DOT dependency graph

digraph {
  rankdir=TB;
  A -> B -> D
  A -> C -> D
  C -> E
}

12. Monitoring Dashboard (L4)

✅ Infographic bar chart

infographic column-chart
data
  title 生产环境关键指标
  items
    - label 可用性
      value 99.95
    - label P50延迟
      value 42
    - label P99延迟
      value 128
    - label 活跃告警
      value 3

✅ Infographic progress chart (project completion)

infographic progress-chart
data
  title Sprint 进度
  items
    - label API开发
      value 100
    - label 前端联调
      value 75
    - label 测试覆盖
      value 60
    - label 文档编写
      value 30

✅ Infographic pie chart (resource proportion)

infographic pie-chart
data
  title 服务器资源分布
  items
    - label Web服务
      value 45
    - label 数据库
      value 30
    - label 缓存
      value 15
    - label 队列
      value 10

13. Complex Table Reports (L3-L4)

✅ HTML merged table

<table>
  <tr><th rowspan="2">模块</th><th colspan="2">性能</th></tr>
  <tr><th>CPU</th><th>内存</th></tr>
  <tr><td>Core</td><td>15%</td><td>256MB</td></tr>
</table>

14. Class Diagram Design (L3-L4)

classDiagram
    class User {
        +String id
        +String email
        +String name
        +login()
        +logout()
    }
    class Order {
        +String id
        +String userId
        +Decimal total
        +submit()
        +cancel()
    }
    class OrderItem {
        +String id
        +String orderId
        +String productId
        +Int quantity
    }
    User "1" --> "*" Order : has
    Order "1" --> "*" OrderItem : contains

15. Code Review Checklist (L2-L3)

Check Item Status Description
Code style conforms to standards ✓ Pass ESLint has no warnings
Unit test coverage >80% ⚠ Warn Currently 72%
No console.log ✓ Pass -
Sensitive information is not hardcoded ✓ Pass -
Documentation has been updated ✗ Fail README not synced

Progressive Enhancement Strategy (by Deliverable Type)

Delivery Stage Strategy Chart Type Example
Draft Plain text shorthand notes None Bullet list, TODO
Discussion Draft Structured + Flowchart Mermaid flow/sequence PRD, Technical Proposal
Review Draft Complete charts + annotations ERD, Architecture Diagram, State Machine Design Review
Final Draft Comprehensive visualization Charts + Data + Styles Launch Documentation

Pitfall Avoidance Guide

Pitfall Solution
Chart too wide and gets truncated Vega-Lite add "width": 400
Mermaid Chinese garbled text Wrap in quotes "中文"
Complex charts are hard to maintain Prefer simple flowcharts; use Canvas for complex ones
Table columns not aligned Use HTML <table> instead of Markdown tables
Formulas not rendering Check $ whether paired, use for block level $$

Quick Reference Path

When you need specific syntax examples, read:

  • ~/dev/ai/markdown-viewer-extension/docs/features/diagrams/mermaid.md
  • ~/dev/ai/markdown-viewer-extension/docs/features/diagrams/vega.md
  • ~/dev/ai/markdown-viewer-extension/demo/test-full.md (comprehensive example)