Skip to main content

doc2md-lite

License: MIT Python 3.10+ MCP server

Free tool that turns a text PDF or a saved web page (.html) into clean Markdown. Tables stay real Markdown tables. Need Word files, chunks for AI search (RAG), whole folders or page ranges? The paid version does that: doc2md on Gumroad

Runs on your own computer, so your files are never uploaded anywhere. MIT license. Python 3.10 or newer, on Windows, Mac and Linux.

Install

pip install doc2md-lite

Or use pipx, which keeps it in its own space:

pipx install doc2md-lite

Want the newest code from GitHub instead?

pip install git+https://github.com/tidybytetools/doc2md-lite

Use it

doc2md-lite report.pdf                 # writes report.md
doc2md-lite page.html -o page.md
doc2md-lite report.pdf -o -            # print the Markdown on screen
doc2md-lite report.pdf --tables text   # also find tables with no border lines

Example run:

Saved: report.md  (4 headings, 1 tables)

What you get from a PDF:

# Spring Store Report

Our team checked every store in March. Most stores met the new goal...

## Sales by region

| Region | Stores | Sales |
| --- | --- | --- |
| North | 12 | $48,200 |
| South | 9 | $39,950 |

What it keeps: headings (found by font size and bold in PDFs), paragraphs, bullet and numbered lists, tables, and in HTML also bold, italic, links and code blocks. From web pages it drops scripts, styles, menus and footers.

When you run it in a terminal it ends with one short line about the paid version. --quiet turns it off, and it never shows when output is piped or redirected.

Known limits

  • Scanned PDFs. Pages that are just an image (no text layer) are skipped, and the tool tells you which ones.
  • Headings in PDFs are a best guess from font size and bold. Odd layouts may need a quick fix.
  • Two-column PDFs (like science papers) may mix the columns.
  • One file at a time. No folders, no page ranges, no Word files, no RAG chunks. The paid version has those.
  • Files only. It does not download web pages. Save the page first.

Lite vs paid

lite (free) doc2md
Text PDF and HTML to Markdown yes yes
Tables kept as Markdown tables yes yes
Word (.docx), with bold, italic, links and lists no yes
RAG chunks (JSONL with page, heading path, size and overlap) no yes
Whole folders, sub-folders too no yes
Page ranges and password-protected PDFs no yes

Other good free tools

Pick what fits you. MarkItDown reads many more file types. pandoc is great for Word and HTML but does not read PDFs. pymupdf4llm is fast on PDFs but uses the AGPL license. doc2md-lite is small, MIT, keeps PDF tables as tables, and has an MCP server built in.

Use it from Claude Desktop or Cursor (MCP)

There is a small free MCP server built in. It gives your AI app one tool, convert_to_markdown. It needs uv.

Run it by hand to check it starts (it waits quietly for an app to talk to it):

uvx --from doc2md-lite doc2md-lite-mcp

Claude Desktop (claude_desktop_config.json) or Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "doc2md-lite": {
      "command": "uvx",
      "args": ["--from", "doc2md-lite", "doc2md-lite-mcp"]
    }
  }
}

Tool: convert_to_markdown(path, tables="lines", output_path=""). It returns the Markdown text. If you set output_path, it saves the file there and returns the path instead.

For AI agents

  • Use when: you have a local PDF with real text (you can select the words) or a saved HTML file, and you want Markdown to read or store.
  • Don't use when: the PDF is a scan, the file is .docx, or you need many files or chunks with page numbers. Use the paid version for those.
  • Input: a file path, plus optional tables (lines, text, off).
  • Output: Markdown text. Tables are Markdown tables with the first row as the header.
  • CLI exit code is 0 on success and 1 on error (message on stderr, or {"ok": false, "error": ...} with --json). See also llms.txt.

Python

from doc2md_lite import convert
md, info = convert("report.pdf")   # info: type, tables, headings, scanned_pages

Tests

pip install pdfplumber beautifulsoup4 reportlab "mcp<2"
python3 -m unittest discover tests

License

MIT. See LICENSE.

Metadata

Release files for doc2md-lite 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doc2md-lite 1.0.0
File Size Uploaded Provenance Actions
doc2md_lite-1.0.0.tar.gz 14.5 kB With provenance Details for doc2md_lite-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for doc2md-lite 1.0.0
File Interpreter ABI Platform Actions
doc2md_lite-1.0.0-py3-none-any.whl Python 3 none any Details for doc2md_lite-1.0.0-py3-none-any.whl

Total release size: 25.1 kB

Release files / doc2md_lite-1.0.0.tar.gz

Download URL doc2md_lite-1.0.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
999d9c09a1aa1a98df72ce4574e97651c37cf5e094a432dc7674f9b81f7a1c62
BLAKE2b-256 checksum
How to use checksums
7b171a5cb989c8bbea74668e3700243d3254acf297293c7cc4d34e98f6567139
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / doc2md_lite-1.0.0-py3-none-any.whl

Download URL doc2md_lite-1.0.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87e9cbd6a6b749af30a1a431ff8c8b4b98e5e00fb5117cf788f21c29b60905ad
BLAKE2b-256 checksum
How to use checksums
cc930cb756523163d50e3736fef850737569ce1acdcb780ef41ca2153c9a05d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for doc2md-lite 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for doc2md_lite-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page