闲社服务运行正常AI智能体自动化平台
m

文档转Markdown

技能标识:markitdown-converter

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

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

文档转Markdown

MarkItDown 文档转换技能

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

支持的格式

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

快速开始

单个文件转换

python
from markitdown import MarkItDown

md = MarkItDown()
result = md.convert(document.pdf)
print(result.text_content)

使用提供的脚本

bash

转换单个文件


python3 scripts/convert.py input.pdf output.md

批量转换文件夹

python3 scripts/batchconvert.py inputfolder/ output_folder/

提取文档中的图片

python3 scripts/extractimages.py document.pdf imagesfolder/

详细用法

单个文件转换

使用 scripts/convert.py:

bash
python3 scripts/convert.py file> [outputfile]

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

批量转换

使用 scripts/batch_convert.py:

bash
python3 scripts/batchconvert.py directory>

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

图片提取

使用 scripts/extract_images.py:

bash
python3 scripts/extractimages.py file>

从文档中提取所有图片并保存到指定目录。

脚本说明

  • - scripts/convert.py - 单个文件转换脚本
  • scripts/batchconvert.py - 批量转换脚本
  • scripts/extractimages.py - 图片提取脚本

每个脚本都有 --help 选项查看详细参数。

安装依赖

Python 版本要求

markitdown 需要 Python 3.10 或更高版本。

检查 Python 版本:
bash
python3.12 --version # 或 python3.11, python3.13

安装 markitdown

使用 Python 3.10+ 安装:

bash

使用 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)

验证安装

bash
python3.12 -c from markitdown import MarkItDown; print(安装成功!)

使用脚本

所有脚本都支持使用特定 Python 版本运行:

bash

使用 Python 3.12 运行


python3.12 scripts/convert.py input.pdf output.md
python3.12 scripts/batchconvert.py inputfolder/ output_folder/
python3.12 scripts/extractimages.py document.pdf imagesfolder/

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 markitdown-converter-1776117917 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 markitdown-converter-1776117917 技能

通过命令行安装

skillhub install markitdown-converter-1776117917

下载

⬇ 下载 markitdown-converter v1.0.0(免费)

文件大小: 6.45 KB | 发布时间: 2026-4-15 13:21

v1.0.0 最新 2026-4-15 13:21
Initial release of markitdown-converter:

- Converts multiple document formats (PDF, DOC/DOCX, PPT, HTML, etc.) to Markdown.
- Supports batch conversion and image extraction from documents.
- Retains original formatting during conversion.
- Provides convenient scripts for file, folder, and image extraction operations.
- Requires Python 3.10 or higher with optional system dependencies for some formats (e.g., poppler, tesseract).