CLI that converts a PDF to Markdown. Two backends, pick with --backend:
vision— rasterize each page, send the image to a vision LLM, get markdown back.marker— OCR/layout via Marker, then a per-image vision pass for figures.
src/pdf2md/cli.py— Click entrypoint (pdf2md convert,pdf2md config).src/pdf2md/pipeline.py— marker backend orchestration.src/pdf2md/vision_first.py— vision backend (async rasterize → vision → optional cleanup pass).src/pdf2md/providers/—anthropic.py,openai.py,openrouter.py. Vision backend needsdescribe_page; cleanup needsclean_document.tests/— pytest.
CLI flag > env var > ~/.pdf2md.json > built-in default. Allowed config keys are listed in CONFIG_KEYS in cli.py; unknown keys raise.
Editable install: uv tool install --editable . → pdf2md on PATH. API keys come from .env in CWD or ~/.env (cascading load at startup).
- Don't commit generated output (
output/,.output/,.output.log) —.gitignorehandles it. - Don't add planning docs to the repo;
docs/superpowers/is gitignored. - Providers must preserve the
(text, input_tokens, output_tokens)tuple shape fordescribe_pageandclean_document.