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
| Criterion | MarkItDown | unstructured | pandoc |
|---|---|---|---|
| Output format | Markdown, ready for LLM | Elements/JSON, needs postprocessing | Many formats, not tailored for RAG |
| Office support | Native | Exists, harder to install | Limited |
| Audio/transcription | Yes | No | No |
| Installation simplicity | One pip package | Many system dependencies | Separate binary |
| Speed on large volumes | Good | Heavier due to labeling models | Fast, 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.
