OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  gdocs-markdown:将 Markdown 文件直接转化为 Google Docs 文档

gdocs-markdown:将 Markdown 文件直接转化为 Google Docs 文档

 
  migration ·  2026-02-04 16:16:15 · 3 次点击  · 0 条评论  

名称: gdocs-markdown
描述: 从 Markdown 文件创建 Google 文档。当用户希望从 Markdown 内容创建 Google 文档,或在使用 gog CLI 时需要向 Google 文档填充内容时使用。此技能通过 Markdown → DOCX → Drive 上传的流程处理转换,因为 gog docs CLI 仅支持创建/导出/查看/复制,但不支持写入/更新内容。


从 Markdown 创建 Google 文档

通过以下工作流程从 Markdown 文件创建 Google 文档:Markdown → DOCX → Drive 上传 → Google 文档。

为什么需要此技能

gog docs CLI 不支持向 Google 文档写入或更新内容。它仅支持:
- create - 创建空文档
- export - 导出到文件
- cat - 读取内容
- copy - 复制现有文档

此技能提供了从 Markdown 创建包含内容的 Google 文档所缺失的工作流程。

作者

techla 创建

前提条件

  • 已通过 Google 账户认证的 gog CLI
  • pandoc 二进制文件(首次使用时若未安装会自动下载)

安装说明

从 ClawHub 安装后,请修复脚本权限:

chmod +x ~/.openclaw/workspace/skills/gdocs-markdown/scripts/gdocs-create.sh

使用方法

快速创建

# 从 markdown 文件创建 Google 文档
gdocs-create.sh /path/to/file.md "文档标题"

手动工作流程

如需更多控制,请按以下步骤操作:

  1. 确保 pandoc 可用:
    bash # 首次使用时将自动下载到 /tmp/pandoc-3.1.11/bin/pandoc # 或者使用系统中已安装的 pandoc

  2. 将 Markdown 转换为 DOCX:
    bash /tmp/pandoc-3.1.11/bin/pandoc input.md -o output.docx

  3. 上传到 Drive(自动转换为 Google 文档):
    bash gog drive upload output.docx

  4. 结果: Google Drive 将返回已转换的 Google 文档链接

脚本参考

查看 scripts/gdocs-create.sh 了解自动化此工作流程的辅助脚本。

示例

# 从 markdown 创建报告
echo "# 报告\n\n内容..." > /tmp/report.md
gdocs-create.sh /tmp/report.md "二月报告"

# 输出:https://docs.google.com/document/d/xxxxx/edit

注意事项

  • Google Drive 在上传时会自动将 DOCX 转换为 Google 文档格式
  • 生成的文档可在 Google 文档中完全编辑
  • 原始 DOCX 文件仍保留在 Drive 中,但如果只需要 Google 文档版本可以删除
3 次点击  ∙  0 人收藏  
登录后收藏  
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor