markitdown-converter

使用微软 markitdown 库将多种文档格式(PDF、DOC、DOCX、PPT、HTML等)转换为 Markdown。支持批量转换、保留格式、图片提取等功能。使用场景:(1) "把这个 PDF 转成 Markdown",(2) "批量转换这个文件夹里的文档",(3) "提取文档中的图片"。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "markitdown-converter" with this command: npx skills add wang-junjian/markitdown-converter

MarkItDown 文档转换技能

使用微软的 markitdown 库将各种文档格式转换为 Markdown。

支持的格式

  • PDF (.pdf)
  • Word 文档 (.doc, .docx)
  • PowerPoint 演示文稿 (.ppt, .pptx)
  • Excel 电子表格 (.xlsx)
  • HTML 文件 (.html, .htm)
  • 图片文件 (通过 OCR)
  • 纯文本文件
  • 等等...

快速开始

单个文件转换

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 <input_file> [output_file]

如果不指定输出文件,会自动生成 .md 文件。

批量转换

使用 scripts/batch_convert.py

python3 scripts/batch_convert.py <input_directory> <output_directory>

会递归处理目录中的所有支持的文件。

图片提取

使用 scripts/extract_images.py

python3 scripts/extract_images.py <input_file> <output_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(推荐)
python3.12 -m pip install --user --break-system-packages "markitdown[all]"

# 或使用虚拟环境
python3.12 -m venv markitdown-env
source markitdown-env/bin/activate
pip install "markitdown[all]"

可选:系统依赖

某些格式转换可能需要额外的系统依赖:

  • PDF 处理: brew install poppler (macOS) 或 apt install poppler-utils (Linux)
  • OCR: brew install tesseract (macOS) 或 apt 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/

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Doc Genius

支持PDF、Word、Markdown智能摘要和格式转换,提供批量处理与进度报告,提升文档处理效率。

Registry SourceRecently Updated
3100Profile unavailable
General

Microsoft MarkItDown

Convert various document formats (PDF, Word, PowerPoint, Excel, images, audio, HTML, etc.) to Markdown using Microsoft's markitdown tool. Supports OCR, audio...

Registry SourceRecently Updated
1330Profile unavailable
Coding

Joe's Markdown to DOCX Converter

Convert Markdown files to fully formatted Word DOCX documents with support for tables, images, code blocks, and GitHub Flavored Markdown features.

Registry SourceRecently Updated
3030Profile unavailable
General

Akashic Doc Analyzer

Parse, analyze, and extract content from documents (PDF, DOCX, PPTX, audio). Supports OCR, table extraction, and semantic chunking.

Registry SourceRecently Updated
1380Profile unavailable
markitdown-converter | V50.AI