R_REDDYX.XYZ
Code Tools2026-08-17

MarkItDown in 2026: converting PDF and Office to Markdown for RAG with a single command

MarkItDown in 2026: converting PDF and Office to Markdown for RAG with a single command
TL;DR: Before a document enters RAG, it needs to be converted into plain text while preserving structure: headings, tables, lists. MarkItDown from Microsoft does exactly this for PDF, Word, Excel, PowerPoint, images, and even audio — outputting Markdown that LLMs understand much better than raw text.

Project card — stars, tech stack, link to sources — in REDDYX catalog: microsoft/markitdown.

WHY RAG NEEDS MARKDOWN

If you simply extract text from PDF using a library like PyPDF2, the structure is lost: it's unclear where the heading is, where a table cell is, where a figure caption is. The model performs worse on questions about such «flat» text. Markdown preserves hierarchy (#, ##), tables remain tables, lists remain lists. Chunking by headings works predictably, rather than cutting text in the middle of a sentence.

WHAT IT CAN CONVERT

  • Office formats — Word (.docx), Excel (.xlsx), PowerPoint (.pptx) with preservation of tables and slide structure.
  • PDF — extracting text and tables, recognizing document structure.
  • Images — EXIF metadata, and with a connected vision model — description of content.
  • Audio — speech-to-text transcription via built-in integration with recognition.
  • HTML, CSV, JSON, ZIP archives — recursive processing of nested files.

INSTALLATION AND QUICK START

pip install markitdown

# CLI: файл сразу в markdown
markitdown report.pdf > report.md

Via Python API — the same thing, but embedded directly into the document processing pipeline:

from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("quarterly_report.pdf")
print(result.text_content)  # готовый markdown

# Пакетная обработка папки с документами
import pathlib
for path in pathlib.Path("docs").glob("**/*"):
    if path.is_file():
        try:
            out = md.convert(str(path))
            (path.with_suffix(".md")).write_text(out.text_content)
        except Exception as e:
            print("skip", path, e)

MARKITDOWN VS ALTERNATIVES

CriterionMarkItDownunstructuredpandoc
Output formatMarkdown, ready for LLMElements/JSON, needs postprocessingMany formats, not tailored for RAG
Office supportNativeExists, harder to installLimited
Audio/transcriptionYesNoNo
Installation simplicityOne pip packageMany system dependenciesSeparate binary
Speed on large volumesGoodHeavier due to labeling modelsFast, but simpler logic

INTEGRATION INTO RAG PIPELINE

Typical scheme: incoming documents → MarkItDown → markdown heading chunking → embedding → vector database. This order greatly reduces the share of «noise» chunks compared to chunking raw text extracted by a primitive PDF parser — tables and lists do not fall apart in the middle of a chunk.

Frequently Asked Questions

Does MarkItDown handle scanned PDFs without a text layer?

By itself — limited. For scans, an OCR layer is needed before conversion (e.g., Tesseract), or connecting a vision model to recognize image content.

How is this better than simply asking the LLM to read PDF directly?

Some models can accept PDF as input, but this is more costly in tokens and does not always preserve table structure. Preprocessing into markdown gives a predictable, compact, and reusable result — convert once, use many times.

Does it work on Russian-language documents?

Yes, text extraction is not language-dependent — table and heading positions work the same regardless of content language.

We examine fresh open-source tools every day — from data pipelines to security scanners. If you want to be among the first to see what actually works in 2026 — subscribe to Telegram channel REDDYX AI — new repositories every 30-60 minutes.

New repositories every 30 minutes

REDDYX AI scans GitHub 24/7 and ships the best AI/ML/Web3 projects to Telegram.

Join on Telegram

← All articles

MarkItDown in 2026: converting PDF and Office to Markdown for RAG with a single command | REDDYX AI