Any document,
as Markdown.

mq-conv turns PDFs, Office docs and other formats into structure-preserving Markdown. Local, offline, one binary.

Get started Read the docs View on GitHub
curl -fsSL https://raw.githubusercontent.com/harehare/mq-conv/main/bin/install.sh | bash
$ mq-conv report.pdf --max-tokens 4000
# Quarterly Report

Revenue grew across all regions.

## Results

| Region | Q1  | Q2  |
| ------ | --- | --- |
| EMEA   | 1.2 | 1.5 |
| APAC   | 0.9 | 1.4 |

<!-- mq-conv: next-cursor=18342 chunk-tokens=3921 total-tokens=187450 -->

$ mq-conv report.pdf -q '.h2'
## Results

Convert, then query

Plain Markdown on stdout, ready to pipe into mq. Slice a manual into sections, filter tables, or feed an LLM only what fits.

# Pull one section out of a Word doc
mq-conv document.docx | mq -A 'section::section("Summary")'

# Sections small enough to paste into a prompt
mq-conv manual.pdf -q '.h2 | select(tokens(.) < 500)'

# Only some pages, numbers stay those of the source
mq-conv report.pdf --pages 3-5

Features

Structure from the file itself, not a text dump and not a cloud parser.

Layout-aware PDF

Native glyph parser: columns, headings, lists, ruled and borderless tables, CJK fonts. Running headers and footers removed.

Local & offline

No API keys, no network, no Python or Node runtime. A single static binary.

Parallel

PDF pages and input files convert on all cores. A broken page never takes the document down.

Token budgeting

--max-tokens and --cursor page through large documents at block boundaries.

Built-in queries

-q runs an mq query with tokens(), format() and filename().

Page selection

--pages picks PDF pages, slides, sheets or EPUB chapters.

Images & OCR

--extract-images writes embedded images and links them; Tesseract OCR for scans.

Any format out

--to writes any input as docx, HTML, LaTeX, RST, AsciiDoc, Org, EPUB or JSON.

Modular & WebAssembly

Enable only the formats you need with feature flags; core formats also run in the browser.

Many formats

Detected by extension and magic bytes.

Documents

PDF, Word, PowerPoint, EPUB

Markup

reStructuredText, Org-mode, MediaWiki, AsciiDoc

Spreadsheets & data

Excel, SQLite

Media & archives

Images, audio, video, ZIP, TAR