Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 1.35 KB

File metadata and controls

28 lines (18 loc) · 1.35 KB

pdf2md — notes for Claude

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.

Layout

  • 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 needs describe_page; cleanup needs clean_document.
  • tests/ — pytest.

Config precedence

CLI flag > env var > ~/.pdf2md.json > built-in default. Allowed config keys are listed in CONFIG_KEYS in cli.py; unknown keys raise.

Running locally

Editable install: uv tool install --editable .pdf2md on PATH. API keys come from .env in CWD or ~/.env (cascading load at startup).

Conventions

  • Don't commit generated output (output/, .output/, .output.log) — .gitignore handles it.
  • Don't add planning docs to the repo; docs/superpowers/ is gitignored.
  • Providers must preserve the (text, input_tokens, output_tokens) tuple shape for describe_page and clean_document.