MarkItDown文档转换中文版
/install markitdown-zh
MarkItDown 文档转换技能
使用微软的 markitdown 库将各种文档格式转换为 Markdown。
支持的格式
- PDF (.pdf)
- Word 文档 (.docx)
- PowerPoint 演示文稿 (.pptx)
- Excel 电子表格 (.xlsx .xls)
- HTML 文件 (.html, .htm)
- 纯文本文件 (.txt, .rtf, .xml, .csv, .json)
- 电子书 (.epub)
- 等等...
快速开始
单个文件转换
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)
使用提供的脚本
# 转换单个文件
python3 scripts/convert.py input.pdf output.md
# 批量转换文件夹
python3 scripts/batch_convert.py input_folder/ output_folder/
# 提取文档中的图片
python3 scripts/extract_images.py document.pdf images_folder/
详细用法
单个文件转换
使用 scripts/convert.py:
python3 scripts/convert.py \x3Cinput_file> [output_file]
如果不指定输出文件,会自动生成 .md 文件。
批量转换
使用 scripts/batch_convert.py:
python3 scripts/batch_convert.py \x3Cinput_directory> \x3Coutput_directory>
会递归处理目录中的所有支持的文件。
图片提取
使用 scripts/extract_images.py:
python3 scripts/extract_images.py \x3Cinput_file> \x3Coutput_directory>
从文档中提取所有图片并保存到指定目录。
脚本说明
scripts/convert.py- 单个文件转换脚本scripts/batch_convert.py- 批量转换脚本scripts/extract_images.py- 图片提取脚本
每个脚本都有 --help 选项查看详细参数。
安装依赖
Python 版本要求
markitdown 需要 Python 3.10 或更高版本。
检查 Python 版本:
python3.12 --version # 或 python3.11, python3.13
安装 markitdown
使用 Python 3.10+ 安装:
# 使用 Python 3.12(推荐)
# 安装pipx包管理应用,通过pipx安装包不需要(或者说是自动)新建虚拟环境
sudo apt-get install pipx
# 使用pipx安装markitdown包 all表示支持所有格式
pipx install 'markitdown[all]'
# 或使用虚拟环境(适用于非root用户,如node用户)
python3.12 -m venv markitdown-env
source markitdown-env/bin/activate
pip install "markitdown[all]"
可选:系统依赖
某些格式转换可能需要额外的系统依赖:
- PDF 处理:
brew install poppler(macOS) 或sudo apt-get install poppler-utils(Linux) - OCR:
brew install tesseract(macOS) 或sudo apt-get install tesseract-ocr(Linux)
验证安装
python3.12 -c "from markitdown import MarkItDown; print('安装成功!')"
使用脚本
所有脚本都支持使用特定 Python 版本运行:
# 使用 Python 3.12 运行
python3.12 scripts/convert.py input.pdf output.md
python3.12 scripts/batch_convert.py input_folder/ output_folder/
python3.12 scripts/extract_images.py document.pdf images_folder/
另请参阅
- Microsoft MarkItDown - 上游库
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install markitdown-zh - After installation, invoke the skill by name or use
/markitdown-zh - Provide required inputs per the skill's parameter spec and get structured output
What is MarkItDown文档转换中文版?
使用微软 markitdown 库将多种文档格式(PDF、DOCX、PPTX、XLSX、XLS、CSV、JSON、TXT、EPUB、HTML等)转换为 Markdown。支持批量转换、保留格式、图片提取等功能。使用场景:(1) "把这个 PDF 转成 Markdown",(2) "批量转换这个文件夹里的文档",(... It is an AI Agent Skill for Claude Code / OpenClaw, with 104 downloads so far.
How do I install MarkItDown文档转换中文版?
Run "/install markitdown-zh" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is MarkItDown文档转换中文版 free?
Yes, MarkItDown文档转换中文版 is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does MarkItDown文档转换中文版 support?
MarkItDown文档转换中文版 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created MarkItDown文档转换中文版?
It is built and maintained by mapleshadow (@mapleshadow); the current version is v1.0.3.