to-markdown
A TypeScript-first utility that converts 20+ formats — PDF, DOCX, PPTX, XLSX/CSV, HTML, Jupyter notebooks, ZIP archives, RSS/Atom, images, and audio — into clean Markdown, ready for RAG pipelines and LLM context windows.
What's in the box
Anyone building a RAG pipeline or document workflow that needs to normalise heterogeneous file formats into a single, LLM-friendly representation. Each capability is opt-in — use the parts that fit, leave the rest.
20+ formats
PDF, DOCX, PPTX, XLSX, CSV, HTML, IPYNB, ZIP, XML/RSS/Atom, images, and audio — all through one convert call.
Promise-based API
`convertToMarkdown(input)` takes a path, Buffer, or base64 string and returns a Markdown string with auto format detection.
TypeScript first
Written in TypeScript with full type definitions and zero-config import in modern toolchains.
AI-ready rich output
`convertToRichMarkdown` adds frontmatter, a section tree, and optional token-aware RAG chunks for ingestion.
Optional OCR
Opt-in image and scanned-PDF OCR via the tesseract.js peer dependency, with auto / always / never PDF modes.
Modular & fast
Per-format converters keep the bundle lean — only load the adapters you actually need.
How it runs
A small, modular pipeline: detect the source format, run the right adapter, normalise the structure, and emit clean Markdown — ready to chunk and embed.
Inputs
- PDF · DOCX
- HTML · plain text
- Excel · CSV
- Bring-your-own buffer
Options
imageModetableStrategyheadingDepthchunkHint
Output
- Clean Markdown
- Stable headings
- Per-doc metadata
- Streaming-friendly
Quickstart
Install, configure, run. The example below is the smallest piece of code that does something useful in production.
How it compares
Against the utilities options teams most often weigh — focused on operational concerns, not feature inventories.
| Capability | to-markdown | pandoc | unstructured.io | turndown |
|---|---|---|---|---|
| ● native | ◐ partial | ● native | ○ missing | |
| DOCX / PPTX | ● native | ● native | ● native | ○ missing |
| HTML | ● native | ● native | ● native | ● native |
| Excel / CSV | ● native | ◐ partial | ● native | ○ missing |
| TypeScript | ● native | ○ missing | ○ missing | ● native |
| Open source | ● native | ● native | ◐ partial | ● native |