Loading...
Loading...
Compare original and translation side by side
feishu-cliconverter/client/board.gocmd/import_markdown.gofeishu-cli-writefeishu-cli-importfeishu-cli-plantumlfeishu-cliconverter/client/board.gocmd/import_markdown.gofeishu-cli-writefeishu-cli-importfeishu-cli-plantuml| Markdown 语法 | Block Type | 飞书块名称 | 说明 |
|---|---|---|---|
| 3-8 | Heading1-6 | 最多 6 级(7-9 级导出降级为粗体段落) |
| 普通段落 | 2 | Text | 纯文本 |
| 12 | Bullet | 支持无限深度嵌套 |
| 13 | Ordered | 支持无限深度嵌套 |
| 17 | Todo | 任务列表 |
| 14 | Code | 代码块(支持语言标识) |
| 34 | QuoteContainer | 引用容器(导入使用 QuoteContainer) |
| 19 | Callout | 高亮块(6 种类型,见第 5 节) |
| 22 | Divider | 分割线 |
| Markdown 表格 | 31 | Table | 超过 9 行自动拆分(见第 6 节) |
| 27 | Image | 占位块(见第 7 节) |
| 21→43 | Diagram→Board | 自动转飞书画板(见第 3 节) |
| 21→43 | Diagram→Board | 自动转飞书画板(见第 4 节) |
| 16 | Equation | 块级公式(降级为行内 Equation) |
| — | InlineEquation | 行内公式 |
| Markdown Syntax | Block Type | Feishu Block Name | Description |
|---|---|---|---|
| 3-8 | Heading1-6 | Up to 6 levels (H7-H9 will be downgraded to bold paragraphs when exported) |
| Normal paragraph | 2 | Text | Plain text |
| 12 | Bullet | Supports unlimited depth nesting |
| 13 | Ordered | Supports unlimited depth nesting |
| 17 | Todo | Task list |
| 14 | Code | Code block (supports language identifiers) |
| 34 | QuoteContainer | Quote container (uses QuoteContainer for import) |
| 19 | Callout | Highlight block (6 types, see Section 5) |
| 22 | Divider | Divider line |
| Markdown table | 31 | Table | Automatically split when exceeding 9 rows (see Section 6) |
| 27 | Image | Placeholder block (see Section 7) |
| 21→43 | Diagram→Board | Automatically converted to Feishu board (see Section 3) |
| 21→43 | Diagram→Board | Automatically converted to Feishu board (see Section 4) |
| 16 | Equation | Block-level formula (downgraded to inline Equation) |
| — | InlineEquation | Inline formula |
| Markdown | 效果 | 说明 |
|---|---|---|
| 粗体 | Bold TextStyle |
| 斜体 | Italic TextStyle |
| | InlineCode TextStyle |
| Strikethrough TextStyle | |
| 下划线 | Underline TextStyle |
| 链接 | Link TextElement |
| 高亮 | Highlight(需启用选项) |
| Markdown | Effect | Description |
|---|---|---|
| Bold | Bold TextStyle |
| Italic | Italic TextStyle |
| | InlineCode TextStyle |
| Strikethrough TextStyle | |
| Underline | Underline TextStyle |
| Link | Link TextElement |
| Highlight | Highlight (requires option enabled) |
- 一级无序
- 二级无序
- 三级无序
1. 四级有序
2. 四级有序
- 三级无序
- 二级无序- Level 1 unordered
- Level 2 unordered
- Level 3 unordered
1. Level 4 ordered
2. Level 4 ordered
- Level 3 unordered
- Level 2 unordered这是最重要的章节。Mermaid 图表导入飞书有严格的语法限制,不遵守会导致渲染失败。
This is the most important section. Mermaid chart import into Feishu has strict syntax restrictions; non-compliance will cause rendering failure.
| 类型 | 声明 | 飞书 diagram_type | 说明 |
|---|---|---|---|
| 流程图 | | 6 (flowchart) | 支持 subgraph |
| 时序图 | | 2 (sequence) | 复杂度限制最严格 |
| 类图 | | 4 (class) | |
| 状态图 | | 0 (auto) | 必须用 v2 |
| ER 图 | | 5 (er) | |
| 甘特图 | | 0 (auto) | |
| 饼图 | | 0 (auto) | |
| 思维导图 | | 1 (mindmap) |
| Type | Declaration | Feishu diagram_type | Description |
|---|---|---|---|
| Flowchart | | 6 (flowchart) | Supports subgraph |
| Sequence Diagram | | 2 (sequence) | Strictest complexity restrictions |
| Class Diagram | | 4 (class) | |
| State Diagram | | 0 (auto) | Must use v2 |
| ER Diagram | | 5 (er) | |
| Gantt Chart | | 0 (auto) | |
| Pie Chart | | 0 (auto) | |
| Mind Map | | 1 (mindmap) |
{}{}{}<!-- ❌ 错误 -->
flowchart TD
A["{name: value}"]
<!-- ✅ 正确 -->
flowchart TD
A["name: value"]{}<!-- ❌ Error -->
flowchart TD
A["{name: value}"]
<!-- ✅ Correct -->
flowchart TD
A["name: value"]par...and...endpar...and...endpar<!-- ❌ 错误 -->
sequenceDiagram
par
A->>B: 请求1
and
A->>C: 请求2
end
<!-- ✅ 正确:用 Note 替代 -->
sequenceDiagram
Note over A,C: 并行处理
A->>B: 请求1
A->>C: 请求2par<!-- ❌ Error -->
sequenceDiagram
par
A->>B: Request 1
and
A->>C: Request 2
end
<!-- ✅ Correct: Replace with Note -->
sequenceDiagram
Note over A,C: Parallel processing
A->>B: Request 1
A->>C: Request 2[text:xxx]<!-- ❌ 可能出错 -->
flowchart TD
A[类型:string]
<!-- ✅ 正确 -->
flowchart TD
A["类型: string"][text:xxx]<!-- ❌ May cause error -->
flowchart TD
A[Type:string]
<!-- ✅ Correct -->
flowchart TD
A["Type: string"]Note over<!-- ❌ 错误:跨太多参与者 -->
sequenceDiagram
Note over A,D: 说明
<!-- ✅ 正确 -->
sequenceDiagram
Note over A,B: 说明Note over<!-- ❌ Error: Too many participants spanned -->
sequenceDiagram
Note over A,D: Description
<!-- ✅ Correct -->
sequenceDiagram
Note over A,B: Description| 维度 | 安全阈值 | 超限风险 |
|---|---|---|
| participant 数量 | ≤ 8 | 超过 10 + 其他因素 → 失败 |
| alt/opt 嵌套 | ≤ 1 层 | 超过 2 层 → 失败风险增大 |
| 消息标签长度 | 简短(≤ 30 字符) | 长标签 + 多参与者 → 失败 |
| 总消息数 | ≤ 30 | 需结合其他因素评估 |
| Dimension | Safe Threshold | Risk of Exceeding |
|---|---|---|
| Number of participants | ≤ 8 | Exceeding 10 + other factors → Failure |
| alt/opt nesting | ≤ 1 layer | Exceeding 2 layers → Increased failure risk |
| Message label length | Short (≤ 30 characters) | Long labels + multiple participants → Failure |
| Total number of messages | ≤ 30 | Need to evaluate with other factors |
{}par...and...endNote over详细的 8 种图表模板和更多正反示例见。references/mermaid-spec.md
{}par...and...endNote overDetailed templates for 8 chart types and more positive/negative examples can be found in.references/mermaid-spec.md
@startuml@enduml@startmindmap@endmindmapskinparam!defineleft to right direction@startuml@enduml@startmindmap@endmindmapskinparam!defineleft to right direction| 图类型 | 安全语法 | 禁忌 |
|---|---|---|
| 活动图 | | 避免过深嵌套 |
| 时序图 | | 避免样式指令 |
| 类图 | | 避免可见性标记(+ - # ~) |
| 用例图 | | 避免复杂布局 |
| 组件图 | | 避免 ArchiMate sprite |
| ER 图 | | 与 Mermaid ER 语法不同 |
| 思维导图 | | 必须用专用包裹标记 |
| Chart Type | Safe Syntax | Forbidden |
|---|---|---|
| Activity Diagram | | Avoid deep nesting |
| Sequence Diagram | | Avoid style directives |
| Class Diagram | | Avoid visibility markers (+ - # ~) |
| Use Case Diagram | | Avoid complex layouts |
| Component Diagram | | Avoid ArchiMate sprite |
| ER Diagram | | Different from Mermaid ER syntax |
| Mind Map | | Must use dedicated wrapping tags |
| 场景 | 推荐 | 原因 |
|---|---|---|
| 流程图 | Mermaid | 飞书原生支持更好,成功率高 |
| 时序图(简单) | Mermaid | 语法简洁 |
| 时序图(复杂) | PlantUML | Mermaid 复杂度限制严格 |
| 类图 | Mermaid | 两者都可,Mermaid 更简洁 |
| ER 图 | Mermaid | 语法更直观 |
| 状态图 | Mermaid | stateDiagram-v2 支持好 |
| 甘特图 | Mermaid | PlantUML 甘特图飞书支持差 |
| 饼图 | Mermaid | 简洁 |
| 思维导图 | 两者均可 | PlantUML 层级标记更灵活 |
| 用例图 | PlantUML | Mermaid 不支持 |
| 组件图 | PlantUML | Mermaid 不支持 |
| 活动图(复杂分支) | PlantUML | 支持更丰富的分支语法 |
| Scenario | Recommendation | Reason |
|---|---|---|
| Flowchart | Mermaid | Better native Feishu support, high success rate |
| Simple Sequence Diagram | Mermaid | Concise syntax |
| Complex Sequence Diagram | PlantUML | Mermaid has strict complexity restrictions |
| Class Diagram | Mermaid | Both are available, Mermaid is more concise |
| ER Diagram | Mermaid | More intuitive syntax |
| State Diagram | Mermaid | Good support for stateDiagram-v2 |
| Gantt Chart | Mermaid | Poor Feishu support for PlantUML Gantt charts |
| Pie Chart | Mermaid | Concise |
| Mind Map | Either | PlantUML has more flexible level markers |
| Use Case Diagram | PlantUML | Not supported by Mermaid |
| Component Diagram | PlantUML | Not supported by Mermaid |
| Activity Diagram with Complex Branches | PlantUML | Supports richer branch syntax |
| 类型 | bgColor | 颜色 | Markdown 语法 | 适用场景 |
|---|---|---|---|---|
| NOTE / INFO | 6 | 蓝色 | | 补充说明、提示信息 |
| WARNING | 2 | 红色 | | 警告、危险提醒 |
| TIP | 4 | 黄色 | | 技巧、建议 |
| CAUTION | 3 | 橙色 | | 注意事项 |
| IMPORTANT | 7 | 紫色 | | 重要信息 |
| SUCCESS | 5 | 绿色 | | 成功、通过 |
| Type | bgColor | Color | Markdown Syntax | Applicable Scenario |
|---|---|---|---|---|
| NOTE / INFO | 6 | Blue | | Supplementary explanations, prompt information |
| WARNING | 2 | Red | | Warnings, danger reminders |
| TIP | 4 | Yellow | | Tips, suggestions |
| CAUTION | 3 | Orange | | Notes |
| IMPORTANT | 7 | Purple | | Important information |
| SUCCESS | 5 | Green | | Success, pass status |
> [!NOTE]
> 这是一条补充说明信息。
> [!WARNING]
> 此操作不可逆,请谨慎执行。
> [!TIP]
> 使用 `--verbose` 参数可以查看详细进度。
> [!CAUTION]
> 注意:API 有频率限制。
> [!IMPORTANT]
> 必须在执行前配置环境变量。
> [!SUCCESS]
> 所有测试用例已通过。> [!NOTE]
> This is supplementary explanatory information.
> [!WARNING]
> This operation is irreversible, please proceed with caution.
> [!TIP]
> Use the `--verbose` parameter to view detailed progress.
> [!CAUTION]
> Note: The API has frequency limits.
> [!IMPORTANT]
> Environment variables must be configured before execution.
> [!SUCCESS]
> All test cases have passed.EmojiIdBackgroundColorINFONOTEEmojiIdBackgroundColorINFONOTEconverter/markdown_to_block.go| 表格行数 | 处理方式 |
|---|---|
| ≤ 9 行(含表头) | 直接创建单个表格 |
| > 9 行 | 拆分为多个表格,每个最多 8 行数据 + 1 行表头 |
converter/markdown_to_block.go| Number of Table Rows | Processing Method |
|---|---|
| ≤ 9 rows (including header) | Directly create a single table |
| > 9 rows | Split into multiple tables, each with up to 8 data rows + 1 header row |
converter/markdown_to_block.go:25-103| 参数 | 值 | 说明 |
|---|---|---|
| 中文字符宽度 | 14px | 非 ASCII 字符 |
| 英文字符宽度 | 8px | ASCII 字符 |
| 列内边距 | 16px | 每列额外边距 |
| 最小列宽 | 80px | 不能更窄 |
| 最大列宽 | 400px | 不能更宽 |
| 文档默认宽度 | 700px | 总宽度不足时按比例扩展 |
converter/markdown_to_block.go:25-103| Parameter | Value | Description |
|---|---|---|
| Chinese character width | 14px | Non-ASCII characters |
| English character width | 8px | ASCII characters |
| Column padding | 16px | Extra padding per column |
| Minimum column width | 80px | Cannot be narrower |
| Maximum column width | 400px | Cannot be wider |
| Default document width | 700px | Expand proportionally when total width is insufficient |
| 列1 | 列2 | 列3 |
|-----|-----|-----|
| 数据 | 数据 | 数据 || Column 1 | Column 2 | Column 3 |
|-----|-----|-----|
| Data | Data | Data |feishu-clifeishu-clifeishu-cli media uploadfeishu-cli media upload$E = mc^2$已知 $a^2 + b^2 = c^2$,当 $a = 3, b = 4$ 时,$c = 5$。$E = mc^2$Given $a^2 + b^2 = c^2$, when $a = 3, b = 4$, $c = 5$.$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$feishu-cli doc importcmd/import_markdown.go| 阶段 | 方式 | 处理内容 |
|---|---|---|
| 阶段一 | 顺序 | 按文档顺序创建所有块,为图表创建空画板占位块,收集表格任务 |
| 阶段二 | 并发 | 图表 worker 池(默认 5 并发)+ 表格 worker 池(默认 3 并发)同时处理 |
| 阶段三 | 逆序 | 处理失败的图表:删除空画板块,在原位置插入代码块(逆序避免索引偏移) |
feishu-cli doc importcmd/import_markdown.go| Stage | Method | Processing Content |
|---|---|---|
| Stage 1 | Sequential | Create all blocks in document order, create empty board placeholder blocks for charts, collect table tasks |
| Stage 2 | Concurrent | Chart worker pool (default 5 concurrency) + table worker pool (default 3 concurrency) process simultaneously |
| Stage 3 | Reverse Order | Process failed charts: delete empty board blocks, insert code blocks at original positions (reverse order avoids index offset) |
| 限制 | 值 | 处理方式 |
|---|---|---|
| 单次创建块数 | 最多 50 个 | 自动分批( |
| 单个表格行数 | 最多 9 行 | 自动拆分并复制表头 |
| 文件大小 | 最大 100MB | 超出直接报错 |
| API 频率 | 429 Too Many Requests | 自动重试 + 线性退避 |
| Restriction | Value | Processing Method |
|---|---|---|
| Maximum number of blocks created per request | 50 | Automatic batching ( |
| Maximum rows per table | 9 | Automatic splitting with header copying |
| File size | Maximum 100MB | Direct error reporting when exceeded |
| API frequency | 429 Too Many Requests | Automatic retry + linear backoff |
| 错误类型 | 判断条件 | 处理方式 |
|---|---|---|
| 语法错误 | | 不重试,直接降级为代码块 |
| 服务端错误 | 500/502/503、 | 重试(最多 10 次,1s 间隔) |
| 频率限制 | 429、 | 重试(归为可重试错误) |
| 重试耗尽 | 超过最大重试次数 | 降级为代码块 |
| Error Type | Judgment Condition | Processing Method |
|---|---|---|
| Syntax Error | | No retry, directly downgrade to code block |
| Server Error | 500/502/503, | Retry (up to 10 times, 1s interval) |
| Rate Limit | 429, | Retry (classified as retryable error) |
| Retry Exhausted | Exceed maximum retry times | Downgrade to code block |
| 参数 | 默认值 | 说明 |
|---|---|---|
| 5 | 图表(Mermaid/PlantUML)并发导入数 |
| 3 | 表格并发填充数 |
| 10 | 图表最大重试次数 |
| false | 显示详细进度 |
| Parameter | Default Value | Description |
|---|---|---|
| 5 | Number of concurrent imports for charts (Mermaid/PlantUML) |
| 3 | Number of concurrent table fill operations |
| 10 | Maximum number of retries for charts |
| false | Display detailed progress |
/open-apis/board/v1/whiteboards/{id}/nodes/plantumlsyntax_typediagram_type/open-apis/board/v1/whiteboards/{id}/nodes/plantumlsyntax_typediagram_type{}par...and...end{}par...and...end@startuml@endumlskinparam+ - # ~@startuml@endumlskinparam+ - # ~$...$$$...$$$...$$$...$$--diagram-workers--table-workers--verbose--diagram-workers--table-workers--verbose