MarkItDown Skill
Documentation and utilities for converting documents to Markdown using Microsoft's MarkItDown library.
Note: This skill provides documentation and a batch script. The actual conversion is done by the markitdown CLI/library installed via pip.
When to Use
Use markitdown for:
- - 📄 Fetching documentation (README, API docs)
- 🌐 Converting web pages to markdown
- 📝 Document analysis (PDFs, Word, PowerPoint)
- 🎬 YouTube transcripts
- 🖼️ Image text extraction (OCR)
- 🎤 Audio transcription
Quick Start
CODEBLOCK0
Supported Formats
| Format | Features |
|---|
| PDF | Text extraction, structure |
| Word (.docx) |
Headings, lists, tables |
| PowerPoint | Slides, text |
| Excel | Tables, sheets |
| Images | OCR + EXIF metadata |
| Audio | Speech transcription |
| HTML | Structure preservation |
| YouTube | Video transcription |
Installation
The skill requires Microsoft's markitdown CLI:
CODEBLOCK1
Or install specific formats only:
CODEBLOCK2
Common Patterns
Fetch Documentation
CODEBLOCK3
Convert PDF
CODEBLOCK4
Batch Convert
CODEBLOCK5
Python API
CODEBLOCK6
Troubleshooting
"markitdown not found"
CODEBLOCK7
OCR Not Working
CODEBLOCK8
What This Skill Provides
| Component | Source |
|---|
| INLINECODE2 CLI | Microsoft's pip package |
| INLINECODE3 Python API |
Microsoft's pip package |
|
scripts/batch_convert.py | This skill (utility) |
| Documentation | This skill |
See Also
MarkItDown 技能
使用微软的 MarkItDown 库将文档转换为 Markdown 格式的文档和实用工具。
注意: 本技能提供文档和批处理脚本。实际转换由通过 pip 安装的 markitdown 命令行工具/库完成。
使用场景
在以下情况使用 markitdown:
- - 📄 获取文档(README、API 文档)
- 🌐 将网页转换为 markdown
- 📝 文档分析(PDF、Word、PowerPoint)
- 🎬 YouTube 字幕
- 🖼️ 图片文本提取(OCR)
- 🎤 音频转录
快速开始
bash
将文件转换为 markdown
markitdown document.pdf -o output.md
转换 URL
markitdown https://example.com/docs -o docs.md
支持的格式
| 格式 | 功能 |
|---|
| PDF | 文本提取、结构保留 |
| Word (.docx) |
标题、列表、表格 |
| PowerPoint | 幻灯片、文本 |
| Excel | 表格、工作表 |
| 图片 | OCR + EXIF 元数据 |
| 音频 | 语音转录 |
| HTML | 结构保留 |
| YouTube | 视频字幕 |
安装
本技能需要微软的 markitdown 命令行工具:
bash
pip install markitdown[all]
或仅安装特定格式:
bash
pip install markitdown[pdf,docx,pptx]
常见模式
获取文档
bash
markitdown https://github.com/user/repo/blob/main/README.md -o readme.md
转换 PDF
bash
markitdown document.pdf -o document.md
批量转换
bash
使用内置脚本
python ~/.openclaw/skills/markitdown/scripts/batch_convert.py docs/*.pdf -o markdown/ -v
或使用 shell 循环
for file in docs/*.pdf; do
markitdown $file -o ${file%.pdf}.md
done
Python API
python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert(document.pdf)
print(result.text_content)
故障排除
markitdown 未找到
bash
pip install markitdown[all]
OCR 无法工作
bash
Ubuntu/Debian
sudo apt-get install tesseract-ocr
macOS
brew install tesseract
本技能提供的组件
| 组件 | 来源 |
|---|
| markitdown 命令行工具 | 微软的 pip 包 |
| markitdown Python API |
微软的 pip 包 |
| scripts/batch_convert.py | 本技能(实用工具) |
| 文档 | 本技能 |
参见