闲社服务运行正常AI智能体自动化平台
f

飞书Markdown转块

技能标识:feishu-md2blocks

Insert rich Markdown content (including tables) into Feishu documents. Use when feishu_doc write/append fails with tables, or when inserting complex formatted content (tables, code blocks, nested lists) into an existing document at a specific position.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

飞书Markdown转块

飞书 Markdown 转块

通过块转换 + 后代 API,将 Markdown 内容(包括表格)插入飞书文档。

使用场景

  • - feishudoc 的 write 操作会替换整个文档;使用此工具可在指定位置插入内容
  • feishudoc 的 createtablewith_values 操作对较大表格存在限制
  • 需要向现有文档中插入表格、代码块或复杂嵌套内容

使用方法

bash

从文件插入(追加到文档末尾)


python3 dir>/scripts/md2blocks.py token> content.md

从标准输入插入

echo | A | B |\n|---|---|\n| 1 | 2 | | python3 dir>/scripts/md2blocks.py token> -

在指定块后插入

python3 dir>/scripts/md2blocks.py token> content.md --after

替换所有内容

python3 dir>/scripts/md2blocks.py token> content.md --replace

工作原理

  1. 1. 调用 POST /docx/v1/documents/blocks/convert 将 Markdown 转换为块结构
  2. 从表格块中移除 merge_info(只读字段,会导致插入错误)
  3. 调用 POST /docx/v1/documents/{doc}/blocks/{parent}/descendant 插入块

后代 API 能够处理嵌套结构(包含文本单元格的表格),这是更简单的 /children API 无法实现的。

位置控制

--after 选项可在指定块后插入内容。脚本会自动查找该块的索引。

关键细节: /descendant API 的 index 参数必须放在请求体中,而不是作为 URL 查询参数。在 URL 中传递 ?index=N 会被静默忽略(内容会追加到末尾)。脚本已正确处理此问题。

支持的 Markdown

文本、标题(h1-h9)、无序列表、有序列表、代码块、引用、表格、待办事项、分隔线。

限制

  • - Markdown 中的图片不会自动上传,需要单独执行上传 + 补丁操作
  • 每次插入调用最多支持 1000 个块;大文档需要拆分
  • 需要在飞书应用中拥有 docx:document:block:convert 权限
  • 文档编辑速率限制:每个文档每秒 3 次操作

参考

完整的块级 API 参考,请参见 feishu-block-ops 技能,其中涵盖:

  • - 所有块 API(创建/读取/更新/删除/批量操作)
  • 块类型参考、文本元素类型
  • 表格操作模式(批量编辑、合并单元格)
  • 常见模式与注意事项

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 feishu-md2blocks-1776272537 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 feishu-md2blocks-1776272537 技能

通过命令行安装

skillhub install feishu-md2blocks-1776272537

下载

⬇ 下载 feishu-md2blocks v1.0.0(免费)

文件大小: 4.02 KB | 发布时间: 2026-4-16 16:38

v1.0.0 最新 2026-4-16 16:38
- Initial release of feishu-md2blocks: Insert rich Markdown (including tables, code blocks, and nested lists) into Feishu documents at specific positions.
- Supports converting Markdown to Feishu blocks, removing problematic merge info from tables, and precise positioning using the descendant API.
- Offers command line usage to append, insert after a block, or fully replace document content.
- Handles complex content that feishu_doc write/append cannot, with support for most standard Markdown features.
- Documents key API details, limitations, and prerequisites for use.
返回顶部