介绍
# Google Docs from Markdown
使用以下工作流从 Markdown 文件创建 Google Docs:Markdown → DOCX → Drive 上传 → Google Docs。
## 为什么存在此技能
`gog docs` CLI 不支持将内容写入/更新到 Google Docs。它仅支持: - `create` - 创建空文档 - `export` - 导出到文件 - `cat` - 读取内容 - `copy` - 复制现有文档
此技能提供了缺失的工作流,以使用 Markdown 中的内容创建 Google Docs。
## 作者
由 **techla** 创建
## 先决条件
- 已使用 Google 账户进行身份验证的 `gog` CLI - `pandoc` 二进制文件(如果不可用,将在首次使用时自动下载)
## 安装说明
从 ClawHub 安装后,请修复脚本权限: ```bash chmod +x ~/.openclaw/workspace/skills/gdocs-markdown/scripts/gdocs-create.sh ```
## 用法
### 快速创建
```bash # Create Google Doc from markdown file gdocs-create.sh /path/to/file.md "Tiêu đề Document" ```
### 手动工作流
如果您需要更多控制权,请执行以下步骤:
1. **确保 pandoc 可用:** ```bash # Auto-downloaded to /tmp/pandoc-3.1.11/bin/pandoc on first use # Or use system pandoc if available ```
2. **将 Markdown 转换为 DOCX:** ```bash /tmp/pandoc-3.1.11/bin/pandoc input.md -o output.docx ```
3. **上传到 Drive(自动转换为 Google Docs):** ```bash gog drive upload output.docx ```
4. **结果:** Google Drive 会返回转换后的 Google Doc 链接
## 脚本参考
请参阅 `scripts/gdocs-create.sh` 了解用于自动执行此工作流的辅助脚本。
## 示例
```bash # Create a report from markdown echo "# Báo Cáo\n\nNội dung..." > /tmp/report.md gdocs-create.sh /tmp/report.md "Báo Cáo Tháng 2"
# Output: https://docs.google.com/document/d/xxxxx/edit ```
## 注意事项
- Google Drive 会在上传时自动将 DOCX 转换为 Google Docs 格式 - 生成的文档可在 Google Docs 中完全编辑 - 原始 DOCX 文件会保留在 Drive 中,但如果只需要 Google Docs 版本,可以将其删除