byteuser1977

文档整理技能 (convert-markdown)

Officev1.0.3
By byteuser1977Updated 2026-05-114 versions · latest released 2026-03-12convert-markdown@clawhub_byteuser1977/convert-markdown
Documents#文档处理#知识库#PDF#批量#文档

According to AlphaMoat, as of 2026-10, 文档整理技能 (convert-markdown) has 13,901 downloads and 2 stars — ranked by downloads #2,010 among 10,914 AI skills in this ranking, and #233 of 909 in Office.

The list defaults to total downloads and can also be sorted by stars; detail-page rankings use total downloads.

Downloads
13.9K
Stars
2
Overall download rank
#2,010
Top 19% overall · Top 26% in Office
PlatformDownloadsStarsComments
ClawHub ↗1.4K--
SkillHub ↗13.9K2—

Platforms count differently and update at different times.

What this skill does

Built on MarkItDown, it converts PDF, Word, PowerPoint, Excel, image, audio, HTML and CSV files in batches while preserving structures such as headings, lists, tables and links where possible. It suits digitising documents, filling a knowledge base and extracting body text. Format support depends on installed optional dependencies, and conversion may omit content or layout; check output against the original files.

Profile published 2026-10-27

What you can do with it

  • Convert a folder of PDFs and Office documents into Markdown
  • Turn a document with tables into text that keeps the table structure

When to use it

  • Existing documents should be loaded into a knowledge base
  • Body text is needed rather than an archive copy

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Convert every PDF and Word file in this folder to Markdown
Keep the tables and heading levels when converting this report

Monthly Trend

Downloads13.9K
5357.7K14.9K2026-03 · Downloads 1.5K2026-05 · Downloads 3.5K2026-06 · Downloads 4.3K2026-07 · Downloads 5.2K2026-08 · Downloads 6.0K2026-09 · Downloads 7.5K2026-10 · Downloads 13.9K26-0326-0926-10
Stars2
0122026-03 · Stars -2026-05 · Stars 12026-06 · Stars 12026-07 · Stars 12026-08 · Stars 12026-09 · Stars 12026-10 · Stars 226-0326-0926-10

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-1013.9K—2
2026-097.5K—1
2026-086.0K+14.3%1
2026-075.2K+22.5%1
2026-064.3K+20.7%1
2026-053.5K—1
2026-031.5K—-

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

8.1 KB · ClawHub v1.0.3
---
name: convert-markdown
version: 1.0.3
description: 文档处理与转换技能,基于 MarkItDown 工具。支持将 PDF、Word、PowerPoint、Excel、图片、音频等多种格式文件批量转换为 Markdown。适用于文档数字化、知识库构建、内容提取等场景。
---

# 文档转换技能 (convert-markdown)

## 概述

Show all (288 lines)
MarkItDown 是 Microsoft 开发的多功能文档转换工具,能够将各种文件格式高质量转换为 Markdown 格式。本技能提供完整的文档处理工作流,包括:

- **多格式支持**:PDF、DOCX、PPTX、XLSX、图片、音频、HTML、CSV、JSON、ZIP、EPub、YouTube URLs 等
- **结构化保留**:保持标题、列表、表格、链接等重要文档结构
- **批量处理**:支持目录递归处理和批量转换
- **OCR 能力**:图片和扫描 PDF 的文本识别
- **音频转录**:音频文件的语音转文本
- **可扩展性**:可选依赖组按需安装,适配不同需求场景

## 快速开始

### 1. 环境准备

确保已安装 Python 3.10 或更高版本。建议使用虚拟环境:

```bash
# 创建虚拟环境
python -m venv .venv

# 激活虚拟环境
# Windows:
.venv\Scripts\activate
# Linux/Mac:
source .venv/bin/activate
```

### 2. 安装 MarkItDown

```bash
# 安装完整功能(推荐)
pip install 'markitdown[all]'

# 或按需安装特定格式支持
pip install 'markitdown[pdf,docx,pptx]'
```

可选依赖组说明:
- `[all]` - 所有格式支持(PDF、Office、图片、音频、HTML 等)
- `[pdf]` - PDF 处理(包含 OCR)
- `[docx]` - Word 文档
- `[pptx]` - PowerPoint
- `[xlsx]` - Excel
- `[image]` - 图片 EXIF 和 OCR
- `[audio]` - 音频转录
- `[html]` - HTML 转换
- `[ytdlp]` - YouTube 下载

### 3. 基本使用

#### NPX CLI 方式(推荐)

本技能提供 NPX CLI 工具,可直接通过 npx 命令调用:

```bash
# 查看帮助
npx convert-markdown

# 转换单个文件
npx convert-markdown convert --input document.pdf --output document.md

# 转换目录
npx convert-markdown convert --input ./docs --output ./markdown

# 批量转换(指定格式)
npx convert-markdown batch --source ./docs --target ./markdown --include .pdf,.docx

# 覆盖已存在文件
npx convert-markdown convert --input document.pdf --output document.md --overwrite
```

**CLI 命令说明:**

| 命令 | 说明 | 参数 |
|------|------|------|
| `convert` | 转换文件或目录 | `--input`, `--output`, `--overwrite` |
| `batch` | 批量转换目录 | `--source`, `--target`, `--include`, `--exclude` |

#### MarkItDown 命令行方式

转换单个文件:
```bash
markitdown document.pdf > document.md
markitdown presentation.pptx -o slides.md
```

批量处理目录:
```bash
# 转换当前目录所有支持文件
markitdown *.pdf *.docx *.pptx

# 递归处理子目录
markitdown ./docs/ --recursive

# 输出到指定目录
markitdown ./source/ -o ./output/
```

#### Python API 方式

```python
from markitdown import MarkItDown

# 创建转换器实例
md = MarkItDown()

# 转换文件
result = md.convert("document.pdf")
print(result.text_content)

# 转换并保存
with open("output.md", "w", encoding="utf-8") as f:
    f.write(result.text_content)
```

## 常见任务

### 任务 1: 批量转换知识库文档

将大量文档批量转换为 Markdown 格式,便于建立搜索索引:

```bash
# 创建输出目录
mkdir converted_docs

# 批量转换并保存
markitdown ./source_documents/ --recursive -o ./converted_docs/
```

### 任务 2: 处理扫描版 PDF

对于扫描的 PDF 文件,需要安装 OCR 依赖:

```bash
pip install 'markitdown[pdf]'  # 包含 OCR 功能
markitdown scanned_document.pdf -o text.md
```

### 任务 3: 提取表格数据

MarkItDown 能够保留原始表格结构:

```bash
markitdown financial_report.xlsx > report.md
# 输出中的表格将保持 Markdown 表格格式
```

### 任务 4: 处理多媒体文件

支持图片 OCR 和音频转录:

```bash
# 提取图片中的文字
markitdown screenshot.png > extracted_text.md

# 转换音频为文字记录
markitdown podcast.mp3 > transcript.md
```

### 任务 5: 集成到自动化流程

在 Python 脚本中使用:

```python
from pathlib import Path
from markitdown import MarkItDown

def convert_directory(input_dir, output_dir):
    """批量转换目录中的所有支持文件"""
    md = MarkItDown()
    input_path = Path(input_dir)
    output_path = Path(output_dir)
    output_path.mkdir(exist_ok=True)

    for file_path in input_path.rglob("*"):
        if file_path.is_file():
            try:
                result = md.convert(str(file_path))
                rel_path = file_path.relative_to(input_path)
                output_file = output_path / rel_path.with_suffix('.md')
                output_file.parent.mkdir(parents=True, exist_ok=True)
                output_file.write_text(result.text_content, encoding='utf-8')
                print(f"✓ {file_path} -> {output_file}")
            except Exception as e:
                print(f"✗ {file_path}: {e}")

# 使用示例
convert_directory("./raw_docs/", "./markdown_docs/")
```

## 高级配置

### 自定义转换选项

```python
from markitdown import MarkItDown, StreamConverter

# 使用流式转换(处理大文件)
with open("large_file.pdf", "rb") as f:
    md = MarkItDown()
    result = md.convert_stream(f)
    print(result.text_content)
```

### 插件系统

MarkItDown 支持自定义转换器插件。如需扩展支持特殊格式,可开发自定义 DocumentConverter:

```python
from markitdown import DocumentConverter

class CustomConverter(DocumentConverter):
    def convert(self, file_stream, **kwargs):
        # 实现自定义转换逻辑
        pass

# 注册插件
md = MarkItDown(converters=[CustomConverter()])
```

### MCP 服务器集成

MarkItDown 提供 Model Context Protocol (MCP) 服务器,可与 Claude Desktop 等 LLM 应用集成:

```bash
# 安装 MCP 服务器
pip install markitdown[all,mcp]

# 配置 Claude Desktop 使用
# 在 claude_desktop_config.json 中添加:
# "mcpServers": {
#   "markitdown": {
#     "command": "python",
#     "args": ["-m", "markitdown.mcp"]
#   }
# }
```

## 最佳实践

1. **安装策略**:生产环境推荐 `[all]` 以确保格式兼容性;资源受限环境可按需安装
2. **内存管理**:处理超大文件时使用 `convert_stream()` 避免内存溢出
3. **错误处理**:转换可能失败(损坏文件、不支持的格式),应捕获异常并记录
4. **编码统一**:始终使用 UTF-8 编码读写 Markdown 文件
5. **文件组织**:输出目录结构与输入目录保持一致,便于维护和追踪
6. **性能优化**:批量转换时可并行处理(多进程/多线程)提高效率

## 故障排除

| 问题 | 可能原因 | 解决方案 |
|------|----------|----------|
| `ModuleNotFoundError` | 依赖未安装 | 重新运行 `pip install 'markitdown[all]'` |
| OCR 不工作 | 缺少 Tesseract | 安装 Tesseract OCR 引擎 |
| 图片转换失败 | PIL/Pillow 缺失 | `pip install pillow` |
| YouTube 失败 | yt-dlp 未安装 | `pip install yt-dlp` |
| 内存不足 | 文件太大 | 使用 `convert_stream()` 或分批处理 |

## 资源目录说明

本技能包含以下资源目录:

- **scripts/** - 可执行脚本(示例和工具)
- **references/** - 参考文档和详细 API
- **assets/** - 模板和配置文件(当前为空)

## 相关链接

- [MarkItDown PyPI](https://pypi.org/project/markitdown/)
- [GitHub 仓库](https://github.com/microsoft/markitdown)
- [MCP 服务器文档](https://github.com/microsoft/markitdown/tree/main/packages/markitdown-mcp)

## 更新日志

- 2026-03-12 - v1.0.3 版本:
  - 修复:修正 CLI 脚本中指向 convert_markonverter.py 的路径错误
  - 优化:更新版本号,保持与 package.json 一致
  - 维护:清理冗余的 Node.js 包装器配置

- 2026-03-09 - 初始版本,基于 MarkItDown 0.1.0+ 创建技能模板

Popular in Office

腾讯文档 TENCENT DOCSOffice

A full manual for creating, editing, and managing Tencent Docs through MCP.

↓ 2.2M★ 327u_b0de8114
WPS Office 全家桶Office

WPS Office 全家桶 - 四引擎(WPS/MS Office/LibreOffice/纯Python)智能识别用户已安装软件,纯Python模式支持排序/筛选/图表/公式/统计,含文档模板(代码生成)、最佳实践案例、故障排除大章(20+避坑+15 FAQ+15错误ID 统一索引)、自动重试、硬件自适应、环境自检、Skill更新提醒;v5.1新增:kingdoc云端桥接(白名单探测+配置预检+subprocess上传+差异检查)、条件格式/数据验证跨引擎IO(JSON中间格式保真往返)、会议纪要三段式要素化(待办清单+决策记录+风险异议)+说话人标注(MFCC聚类);v5.2新增:公文一键排版(GB/T 9704 规则库约束+结构识别套版+红头预留位+联合行文)、批量水印与敏感信息打码(身份证/手机号/银行卡/邮箱双轨识别+黑色矩形覆盖+打码清单)、跨文档知识检索与问答(本地TF-IDF零依赖+跳转+可选zwjh记忆桥接);删除:与contract-review重复的轻量合同审查模块,改为文档互链引导;v5.2.5修复:MS Office引擎下Excel/PPT创建必然失败(错用Word COM对象),新增get_ms_excel/get_ms_ppt及三槽位统一释放release_ms,MS Office路径透传filepath参数;v5.3.5修复:SKILL.md frontmatter 修复 tags 块序列误混入联系方式行导致标准 YAML 解析失败;v5.4.0新增:留存型功能——定时任务与报告中心(schedule_register 升级为三平台统一调度层 schtasks/cron/launchd,错过策略 skip/run_once,注册表 JSON 可导出导入;新建 report_center.py 报告中心,templates/reports/*.json 参数化模板 + ECharts 单文件 HTML 输出(图表内联、无服务端、双击即开);report_generator 升级支持 --format html;wps.py CLI 统一埋点 SQLite,自动供 report_center 生成周度使用摘要附在报告末尾;watch.py 职责收窄为纯事件采集);v5.3.0新增:统一CLI入口 wps(registry.json注册表分发,office --app/--action 与 convert 子命令、--list 一屏列出全部命令,薄路由层不改脚本内部逻辑)、全命令 --json 机器可读输出(固定 ok/error_id/elapsed/data 四字段,对齐 E001-E015,wps_error.py 新增 emit_json 统一出口)、_worker 启动优化(wps_pure 改惰性加载,pywin32/python-docx/openpyxl 经核查已惰性导入,ENGINE_CACHE 进程级单例复用,COM 释放统一走 release_ms 三槽位)、转换三入口合并为 convert(format_converter/md_converter/wps_docx_to_ppt 内部按目标格式路由,旧脚本保留为兼容别名并提示新命令,v6.0.0 移除)

↓ 766.6K★ 159user_1a470ba8
ppt-generator-skillOffice

A skill that generates PPT decks from a topic and style.

↓ 592.7K★ 346user_3b34947d
秘书材料星公文写作-妙笔skillOffice

体制内资深办公室主任+管理学博士,自学编程开发的智能公文写作Skill,让所有办公室同仁少掉头发、少加无用的班,材料一稿过关,省下的时间留给自己、享受生活!————————我们能给你带来的核心价值:1、颠覆传统写作:逻辑建模38类公文全链条,特有模板化引导问答模式,分分钟省心生成高质量大稿。--------2、替你“向上管理”:独有审稿人画像机制,文稿一键结构性修改,精准匹配审稿人画像,过稿率提升至少10倍!----------3、‌杜绝AI编造:缺失的数字、文号、人名、日期一律用[待补]标注,绝不杜撰,守住公文底线。-----------4、‌算法格式托底:数十万全量智控知识库+6500行前沿核心控制代码,格式精准对齐GB/T 9704,出稿零失误。——————————————————本skill历史版本开放了5%知识库的免费试用版,下载即可使用,但需注意:知识库有著作权,仅用于个人使用,不可用于其他任何目的。有兴趣的可以试试。——————————————————————单次付费版skill已发布,2元一次使用全量知识库。具体在发布者“熵衍信息”主页skill里。

↓ 578.4K★ 46u_70fc650d
WPS Office 全家桶Office

WPS Office 全家桶 - 四引擎(WPS/MS Office/LibreOffice/纯Python)智能识别用户已安装软件,纯Python模式支持排序/筛选/图表/公式/统计,含文档模板(代码生成)、最佳实践案例、故障排除大章(20+避坑+15 FAQ+15错误ID 统一索引)、自动重试、硬件自适应、环境自检、Skill更新提醒;v5.0新增:定时任务注册管理(schtasks/crontab)、目录轮询监听(YAML规则+大文件分片)、使用统计与稳定性中心(SQLite埋点+引擎健康+引擎偏好)、COM三步自愈(regsvr32→修复安装→手动指引)、对话式数据查询(NL2SQL式意图解析+查询计划+连续追问)、multi-agent编排引擎桥接(白名单探测+流水线模板注册)

↓ 508.0K★ 4user_814dbe54
WPS全家桶·办公管家.SkillOffice

WPS/MS Office/LibreOffice/纯Python 四引擎智能办公全家桶:文档/表格/PPT/公文/会议纪要一体化。

↓ 429.5K★ 2user_185644ed
腾讯文档在线协作自动化Office

通过 Tencent Docs Open API 以 curl + jq 创建、读取、列出、搜索和管理腾讯文档的自动化工作流,覆盖在线文档、在线表格、幻灯片、思维导图、流程图、智能表格与收集表七种类型,支持读取元数据与单元格区域、上传图片、创建副本,并对重命名/移动/删除等写操作强制先经用户确认。Use when the user 提到腾讯文档 / Tencent Docs / docs.qq.com、粘贴 docs.qq.com 链接,或想在其腾讯文档空间中创建、读取、整理文档时使用。Triggers include 腾讯文档、在线文档、在线表格、思维导图、流程图、智能表格、收集表。如需文案写作完整工作流套件,淘宝搜索「AI灵匣」店铺获取完整版。

↓ 428.1K★ -u_1ea983ac
kdocs skillOffice

The official skill for working with Kdocs cloud documents through kdocs-cli.

↓ 424.1K★ 128user_5ea84866

Data as of 2026-10. Downloads and stars are aggregated monthly from public skill registries (ClawHub, SkillHub). See data methodology.