docmd
Convert PDFs, DOCX, and PPTX to clean, structure-preserving Markdown — from the CLI or a Python library.
Built for feeding documents into LLM and RAG pipelines, where clean Markdown beats raw text extraction.
(Published on PyPI as docmd-cli since docmd was already taken by an unrelated
package — the import (import docmd) and CLI command (docmd convert ...) are
unaffected.)
pip install docmd-cli
docmd convert report.pdf
from docmd import convert
markdown = convert("report.pdf")
print(markdown)
Why docmd
Great open-source document-to-Markdown converters already exist (docmd is built on Marker). The problem isn't quality — it's that running them yourself means a Python environment, several GB of RAM, ideally a GPU, and a non-trivial setup process before you convert your first file.
docmd wraps that engine with sane defaults and adds real post-processing on top
(table cleanup, heading normalization) so the output is closer to what a RAG pipeline
actually wants, not just raw model output.
A hosted API (POST a file, get Markdown back, no local setup) is planned — see
ARCHITECTURE.md. It is not live yet; this repo is the open-source
core, usable standalone today.
What it handles
| Input | Output |
|---|---|
| PDF (text-based) | Markdown with preserved headings, lists, tables |
| PDF (scanned) | Markdown via OCR — bundled by Marker, free |
| DOCX | Markdown with formatting preserved (pip install docmd-cli[full]) |
| PPTX | Markdown, one section per slide (pip install docmd-cli[full]) |
Quickstart
CLI
pip install docmd-cli
docmd convert my-file.pdf -o output.md
Python
from docmd import convert
# From a file path
markdown = convert("my-file.pdf")
# From bytes
with open("my-file.pdf", "rb") as f:
markdown = convert(f.read(), filename="my-file.pdf")
Installing DOCX/PPTX support
The base install (pip install docmd-cli) covers PDF only and stays lean. DOCX and
PPTX need Marker's own additional dependencies:
pip install "docmd-cli[full]"
DOCX/PPTX conversion also needs weasyprint's
native Pango/GObject/Cairo libraries, which pip cannot install for you:
# macOS
brew install pango
# Debian/Ubuntu (24.04 and older)
sudo apt-get install libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
# Debian trixie (13) and newer: libgdk-pixbuf2.0-0 was renamed
sudo apt-get install libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf-2.0-0 libffi-dev shared-mime-info
PDF conversion (the base install) does not need this.
Image handling
Images default to a text placeholder (*[... omitted]*) - no binary data, nothing to
resolve, safe for RAG chunking:
markdown = convert("report.pdf") # image_mode="placeholder" by default
To keep real image links instead, use image_mode="alt-text" and pass output_dir so
the image files actually get saved somewhere the links can resolve to:
from docmd import convert_document
from docmd.config import ConvertConfig
result = convert_document(
"report.pdf",
config=ConvertConfig(image_mode="alt-text"),
output_dir="output/",
)
From the CLI, --image-dir defaults to the output file's directory when -o is given:
docmd convert report.pdf -o output/report.md --image-mode alt-text
image_mode="skip" drops images entirely - no placeholder, no files.
How it works
docmd wraps Marker with sane defaults and a
clean output format, then runs its own post-processing pass
(docmd/postprocess/) to fix table structure and normalize heading levels — see
ARCHITECTURE.md for why this is the actual differentiation, not
just a thin wrapper.
License
The docmd wrapper code is MIT — see LICENSE.
docmd depends on Marker, whose code is
Apache-2.0 and whose model weights are licensed under a modified Open RAIL-M license:
free for research, personal use, and organizations under $5M in funding or revenue.
Commercial use beyond that threshold requires a license from
Datalab. This applies to you if you deploy docmd
commercially at scale — check Marker's current license terms directly before doing so.
Roadmap
- PDF, DOCX, PPTX → Markdown
- Table cleanup / heading normalization post-processing
- Hosted API
- OCR quality tuning for scanned documents
- Batch conversion endpoint
- HTML output option
Contributing
Issues and PRs welcome. If you're hitting a conversion quality issue, please include a sample file (or a minimal reproduction) — it makes fixes much faster.
If docmd saves you the trouble of setting up your own PDF-parsing pipeline, consider starring the repo — it's how other people find it.
Metadata
Release files for docmd-cli 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| docmd_cli-0.1.1.tar.gz | 65.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| docmd_cli-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 81.8 kB
Release files / docmd_cli-0.1.1.tar.gz
| Download URL | docmd_cli-0.1.1.tar.gz |
|---|---|
| Size | 65.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
008e0e97a4ea51114a2e10e35d55ec8a6806eed719722402e5b26eb4f4a5984e
|
|
BLAKE2b-256 checksum How to use checksums |
643aaec57bd01721cbe21441f3743c345ee51c96596800f27363dd291bbcf249
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 18, 2026.
Transparency logRelease files / docmd_cli-0.1.1-py3-none-any.whl
| Download URL | docmd_cli-0.1.1-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48d927b18b8f12e54868e5c27b432106728de8640293c4d6e4b8f1b8f21415aa
|
|
BLAKE2b-256 checksum How to use checksums |
dd767db5ced29fafaae5e5dd2fe525c586ea5fa14a5b64de41f87090044c8e65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 18, 2026.
Transparency log