Convert PDF and office documents to clean Markdown, powered by Docling.
DoMark is a small command-line tool built for complex documents such as textbooks with tables, formulas and diagrams, where simpler converters often produce broken tables and lose figures.
- Convert a single file or a whole folder (optionally recursive)
- Interactive mode (just answer two questions) and full CLI mode
- OCR for scanned pages, with an option to force OCR on every page
- Table structure detection (accurate or fast mode)
- Figures exported as image files, embedded as base64, or skipped
- Page range selection for PDFs (
5,5-20,5-) - Skip files that were already converted
- Progress logging and a summary at the end
- Unit tests that run without installing Docling
PDF, DOCX, PPTX, XLSX, HTML, Markdown, CSV, and images (PNG, JPG, TIFF, BMP).
Requires Python 3.10 or newer.
git clone https://github.com/<your-username>/DoMark.git
cd DoMark
python -m venv .venv
# Windows: .venv\Scripts\activate macOS/Linux: source .venv/bin/activate
pip install -e .The first run downloads Docling's AI models (a few hundred MB), so an internet connection is required once.
domarkFolder path: C:\Users\you\Documents
File name (with extension, optional): book.pdf
Leave the file name empty to convert every supported file in the folder.
# One file (Markdown is written next to the source)
domark book.pdf
# A whole folder, including subfolders, into a separate output folder
domark ./documents -r -o ./markdown
# Only pages 10 to 40
domark book.pdf -p 10-40
# Faster run: no OCR, fast table model, no figures
domark book.pdf --no-ocr --fast-tables --images none
# Scanned book: force OCR on every page
domark scan.pdf --force-ocr
# Skip files that already have a .md output
domark ./documents --no-overwriteYou can also run it as a module: python -m domark book.pdf.
| Option | Description |
|---|---|
input |
File or folder to convert. Omit for interactive mode. |
-o, --output-dir |
Folder for output Markdown (default: next to each source). |
-r, --recursive |
Search subfolders when input is a folder. |
-p, --pages |
Page range for PDFs: 5, 5-20 or 5- (1-based, inclusive). |
--no-ocr |
Disable OCR (faster, scanned pages will be empty). |
--force-ocr |
Run OCR on every page. |
--no-tables |
Disable table structure detection. |
--fast-tables |
Use the faster, less accurate table model. |
--images {referenced,embedded,none} |
Save figures as files, embed as base64, or skip. Default: referenced. |
--images-scale |
Figure resolution multiplier. Default: 2.0. |
--no-overwrite |
Skip files whose .md already exists. |
-v, --verbose |
Show detailed logs. |
--version |
Show the version. |
Exit codes: 0 success, 1 no files found or at least one file failed, 2 invalid arguments.
- Large books (hundreds of pages) can take a long time on a CPU-only machine. Test with
-p 1-20first. --no-ocrand--fast-tablesmake conversion noticeably faster when your PDF already contains selectable text.- With
--images referenced(default), figures are saved in a folder next to the Markdown file and image links are written as relative paths (e.g.book_artifacts/image_000000_abc.png), so the.mdand its_artifactsfolder can be moved together.
pip install -e ".[dev]"
pytest -qProject layout:
DoMark/
src/domark/
cli.py # argument parsing, interactive mode, batch loop
converter.py # Docling integration (lazy import)
utils.py # pure helpers: page ranges, file discovery, output paths
tests/ # pytest suite (does not require Docling)
.github/workflows/tests.yml
See CONTRIBUTING.md for guidelines.
DoMark is a thin wrapper around Docling. All document understanding is done by Docling.