document2md

https://github.com/legistlan/document2md/actions/workflows/test.yml/badge.svg https://badge.fury.io/py/document2md.svg

Version 0.4.0. document2md converts a PDF, or an ordered set of scanned page images, into Markdown, via one of two backends — mineru (OCR and layout analysis) or pymupdf4llm (reading a born-digital PDF’s own embedded text layer, no OCR needed) — optionally cropped down to a single section. This package was extracted from the LegalIA monorepo at commit e1f258c; how it fits with the packages it used to share a repository with is covered on the user site.

Note

This is the developer documentation: architecture, backends, and the full API reference, for extending the package itself. If you only want to use document2md — install it, run it from the command line or from Python, pick a backend — see the user site linked above.

How this documentation is organised

Architecture walks through the conversion pipeline end to end, module by module, in the order a document actually flows through it. Backends explains how backend resolution and dispatch work, and how to add a new backend. Development covers the repository’s own conventions — tests, docs and website builds, versioning, publishing. API reference is the full API reference, one page per module, including private/internal helpers — useful when extending or debugging the package, though they are not part of its public API and can change without notice.