Ingesting raw PDFs often flattens table layouts and strips heading hierarchies. Because LLMs still produce plausible-sounding answers from broken input, teams often miss the corruption until much later. RAG quality splits at the preprocessing stage, long before generation begins.

Text Extraction vs. Structure Preservation

Microsoft’s MarkItDown goes beyond plain text scraping. It preserves tables and heading hierarchies in Markdown so LLMs can parse document structure cleanly. Beyond Word, PowerPoint, Excel, and PDF files, it also processes video subtitles and audio files. Embedded images pass through vision models for description, and scanned documents run through OCR.

Markdown works well for LLMs for two reasons. It uses fewer tokens than HTML or JSON, and language models have seen plenty of Markdown during training, which improves reasoning accuracy. Preserving document structure during preprocessing pays off in both retrieval and generation.

What Changed After 0.1.0

Starting in version 0.1.0, MarkItDown shifted from taking file paths directly to reading binary streams. Processing files in memory without writing temporary files to disk improves server resource efficiency, though teams upgrading from earlier versions will need to check their integration code.

You can install all format handlers at once or pick only the dependencies you need. Built-in MCP server support lets desktop LLM apps like Claude connect directly, and bundled OCR removes the need to install separate system binaries during deployment.

Related Posts