markitdown

Python tool for converting files and office documents to Markdown.

92.9k
Stars
+1898
Stars/month
3
Releases (6m)

Star Growth

+341 (0.4%)
90.8k92.9k94.9kMar 27Apr 1

Overview

markitdown 是一个轻量级 Python 工具,专门将各种文件格式转换为 Markdown,为 LLM 和文本分析管道优化。由 Microsoft AutoGen 团队开发,这个工具支持广泛的文件格式,包括 PDF、PowerPoint、Word、Excel、图像(带 OCR)、音频(带语音转录)、HTML、CSV、JSON、XML、ZIP 文件、YouTube URL 和 EPub 等。与传统的文本提取工具不同,markitdown 专注于保留重要的文档结构元素,如标题、列表、表格和链接,同时输出高度兼容 LLM 的 Markdown 格式。该工具的设计理念是 Markdown 格式对主流 LLM(如 GPT-4)极其友好,因为这些模型在训练中接触了大量 Markdown 文本,能够原生理解和生成 Markdown。此外,Markdown 格式在 token 使用上也很高效。markitdown 还提供 MCP(Model Context Protocol)服务器集成,可与 Claude Desktop 等 LLM 应用无缝协作。该工具采用流式处理,不创建临时文件,提高了性能和安全性。

Deep Analysis

Key Differentiator

Microsoft's official document-to-Markdown converter for LLMs — built by the AutoGen team with MCP server support, unlike textract which predates the LLM era

Capabilities

  • Convert 15+ file formats to Markdown (PDF, Word, Excel, PPT, images, audio)
  • Preserve document structure (headings, tables, lists, links)
  • OCR support via LLM Vision (markitdown-ocr plugin)
  • Audio speech transcription
  • Azure Document Intelligence integration
  • MCP server for LLM application integration
  • Plugin system for extensibility
  • CLI and Python API

🔗 Integrations

OpenAIAzure Document IntelligenceMCPClaude Desktop

Best For

  • Converting documents to Markdown for LLM consumption in RAG pipelines
  • Batch document processing for AI text analysis

Not Ideal For

  • High-fidelity document conversion for human consumption
  • Real-time document streaming

Languages

Python

Deployment

pip installDockerCLI tool

Pricing Detail

Free: Completely free and open-source (MIT)
Paid: No paid tier; Azure Document Intelligence costs apply if used

Known Limitations

  • Output optimized for LLMs, not high-fidelity human reading
  • OCR quality depends on LLM Vision model used
  • Python 3.10+ required
  • Limited formatting preservation for complex layouts

Pros

  • + 支持超过 10 种文件格式,包括办公文档、图像 OCR 和音频转录,覆盖面极广
  • + 专为 LLM 优化的 Markdown 输出,保留文档结构的同时确保 AI 模型兼容性
  • + 提供 MCP 服务器集成,可直接与 Claude Desktop 等 AI 应用协作

Cons

  • - 版本间有重大变更,从 0.0.1 到 0.1.0 的 API 变化可能影响现有代码
  • - 需要 Python 3.10 或更高版本,对旧环境支持有限
  • - 主要面向机器分析而非人类阅读,可能不适合高保真度的文档转换需求

Use Cases

  • 为 LLM 分析准备各类办公文档和 PDF,提取结构化文本内容
  • 构建文档处理管道,将多格式文件批量转换为统一的 Markdown 格式
  • 集成到 AI 工作流中,通过 OCR 和语音转录处理图像和音频内容

Getting Started

1. 安装:pip install 'markitdown[all]' 获取完整功能;2. 导入并创建转换器:from markitdown import MarkItDown, md = MarkItDown();3. 转换文件:result = md.convert('document.pdf') 并访问 result.text_content 获取 Markdown 文本

Compare markitdown