Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pdf-to-markdown

> 数据库
Open source

Turn PDFs into clean, structured Markdown

198 stars0 likes1 views
WebsiteGitHub

About

Turn PDFs into clean, structured Markdown

PDF to Markdown

Turn PDFs into clean, structured Markdown

pdf2md extracts a PDF's structure - headings, lists, tables, code, math, links, and images - not just its raw text. It is built on the MIT-licensed pdfplumber / pdfminer.six, with no AGPL (PyMuPDF) and no heavy ML/OCR stack anywhere in the dependency tree. Install, import, and run it as pdf2md.

Install

bash
uv sync

Usage

bash
uv run pdf2md --pdf_path paper.pdf --out out/
# → writes out/paper.md; extracted images land in out/ and are linked relative to the .md

Features

  • Headings from document-wide font-size statistics
  • Text: paragraphs (de-hyphenated), bold / italic / inline code, super/subscript, links
  • Lists (ordered, unordered, nested), blockquotes, horizontal rules
  • Code blocks via monospace-font detection
  • Tables - ruled and borderless, as GFM pipe tables
  • Math → LaTeX - inline $…$ and display $$…$$ (heuristic)
  • Layout - multi-column reading order, rotated/landscape pages, header/footer stripping
  • Footnotes, table of contents, images, and CJK / Unicode text

Behaviour is tunable in config/config.yaml.

Optional: high-accuracy math

Core math extraction is heuristic. For accurate equations, install the opt-in ML extra (pix2tex, which pulls in BSD torch - kept out of the core so the default install stays lean):

bash
uv sync --extra math

Optional: progress bar

Every step of the pipeline reports itself, so a long conversion is never a black box. Steps that walk the pages get a bar; one-off steps print a [pdf2md] line:

[pdf2md] features on: images, borderless tables, blockquotes, footnotes, bold headings
extracting images: 100%|##########| 1477/1477 [01:33 0` is
per-page progress, `total == 0` is a one-off step. The pipeline never imports
tqdm itself, so nothing is pulled in unless you ask for it:

```python
from pdf2md import PdfToMarkdown

PdfToMarkdown(progress=lambda stage, done, total: print(stage, done, total))

Limitations

  • No OCR - scanned / image-only pages yield embedded images only.
  • Math is heuristic - complex equations are best-effort (use --extra math).
  • Dense multi-table pages and right-to-left scripts may need manual review.

License

MIT - see LICENSE.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythondocument-conversiondocument-processinginformation-retrievalpdf-converter

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库