Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

convert-file2md ๐Ÿ“„โ†’๐Ÿ“

Batch convert PDF, DOCX, PPTX, and XLSX files to Markdown using the mineru engine.

A simple Python CLI tool that wraps mineru to convert office documents and PDFs into clean Markdown with extracted images.

Features

  • ๐Ÿ“„ Multi-format โ€” PDF, DOCX, PPTX, XLSX
  • ๐Ÿ–ผ๏ธ Image extraction โ€” Auto-extracts embedded images to images/ subdirectory
  • ๐ŸŒ Multi-language โ€” Chinese, Japanese, Korean, Arabic, and more
  • ๐Ÿ“ฆ Batch mode โ€” Process entire directories at once
  • ๐Ÿ” OCR support โ€” For scanned documents and image-based PDFs
  • ๐Ÿงน Auto-cleanup โ€” Removes intermediate files by default

Installation

# Clone the repo
git clone https://github.com/thousandcents/convert-file2md.git
cd convert-file2md

# Install dependencies
pip install mineru

# Make it executable
chmod +x convert2md.py

Usage

# Single file
python3 convert2md.py -i document.pdf -o ./output/

# Batch
python3 convert2md.py -i ./input/ -o ./output/

# Chinese document
python3 convert2md.py -i ไธญๆ–‡ๆ–‡ๆกฃ.pdf -o ./output/ -l ch

# Scanned PDF (OCR mode)
python3 convert2md.py -i scanned.pdf -o ./output/ -m ocr

All Options

-h, --help              Show help message
-i, --input PATH        Input file or directory (default: ./input/)
-o, --output PATH       Output directory (default: ./output/)
-b, --backend BACKEND   mineru backend: pipeline (default), vlm-http-client,
                        hybrid-http-client, vlm-auto-engine, hybrid-auto-engine
-m, --method METHOD     Parse method: auto (default), txt, ocr
-l, --lang LANG         Document language: en (default), ch, japan, korean, ...
    --keep-intermediates Keep temp files (default: clean up)

Output

output/
โ””โ”€โ”€ DocumentName/
    โ”œโ”€โ”€ DocumentName.md
    โ””โ”€โ”€ images/
        โ”œโ”€โ”€ image1.png
        โ””โ”€โ”€ image2.jpg

Requirements

  • Python 3.7+
  • mineru CLI โ€” install via pip install mineru

About

This tool was originally created as a skill for Hermes Agent to enable document-to-markdown conversion within AI agent workflows. It can be used standalone or integrated into any automation pipeline.

License

MIT

About

๐Ÿ“„โ†’๐Ÿ“ Convert PDF, DOCX, PPTX, and XLSX files to Markdown using the mineru engine. Batch processing, OCR support, multi-language.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages