CyberMD is a flexible tool for converting various document formats into clean Markdown, supporting both OCR-based extraction (for PDFs and images) and direct conversion (for DOCX, PPTX, XLSX). The project includes a Streamlit web interface for interactive use, a CLI script for batch processing, and a REST API for programmatic access.
- Multi-format Support: Convert PDF, JPG, PNG, DOCX, PPTX, XLS, XLSX to Markdown
- OCR Processing: Extract text and structure from scanned documents and images using Rednote DotsOCR
- Direct Conversion: Use MarkItDown for accurate conversion of Office files without OCR overhead
- Web Interface: Interactive UI with file upload, progress tracking, and download capability
- REST API: Programmatic access via HTTP API with dynamic API key authentication
- CLI Mode: Batch process files from an input directory using environment configuration
- Cache Management: Temporary file management with automatic cleanup functionality
| Type | Extensions | Processor |
|---|---|---|
| OCR Input | .pdf, .jpg, .jpeg, .png | OCRProcessor |
| Office | .docx, .pptx, .xls, .xlsx | MarkItDownProcessor |
Using uv (recommended):
uv sync --python 3.12Project structure:
project-root/
├── main.py # Streamlit web interface
├── cli.py # CLI batch processor
├── endpoint-api.py # FastAPI REST server
├── tools/
│ ├── ocr_processor.py
│ ├── markitdown_process.py
│ └── dots_ocr/
├── input/
├── output/
├── api_upload/
├── api_output/
├── api_cache/
└── .env (optional)
Launch the Streamlit interface:
uv run streamlit run main.pyUpload a document, click "Start Processing", and download the resulting Markdown.
Place files in the input/ directory and run:
uv run cli.pyProcessed Markdown files will appear in the output/ directory.
Note: You can customize input/output paths via .env file (see Configuration).
Launch the FastAPI server:
uv run uvicorn endpoint-api:app --host 0.0.0.0 --port 8000On startup, the API key will be printed and saved to .api_key file.
# Get API key
curl http://localhost:8000/api-key
# Convert a document via upload
curl -X POST "http://localhost:8000/convert" \
-H "X-API-Key: your_api_key_here" \
-F "file=@document.pdf"
# Convert from server file path
curl -X POST "http://localhost:8000/convert/file-path" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"file_path": "./input/document.pdf", "processor_type": "auto"}'
# Health check
curl -H "X-API-Key: your_api_key_here" http://localhost:8000/healthInstall the plugin in your Obsidian vault:
- Copy
obsidian-plugin/folder toyour-vault/.obsidian/plugins/cybermd-converter/ - Enable the plugin in Obsidian settings
- Configure API URL and API Key in plugin settings
- Click the ribbon icon to open the converter sidebar
See obsidian-plugin/README.md for detailed instructions.
Create a .env file to override default settings:
INPUT_DIR=./input
OUTPUT_DIR=./output
API_PORT=8000In main.py, you can also adjust these global settings:
NO_IMAGE = True # Skip image output in OCR
NO_TABLE = False # Enable table extraction in OCRHandles scanned documents and images using OCR. Outputs structured Markdown with layout preservation.
- Input: PDF, JPG, JPEG, PNG
- Engine: Rednote DotsOCR
- Configuration:
no_image,no_table,delete_cache
Converts Office files directly to Markdown, preserving headings, lists, tables, and formatting.
- Input: DOCX, PPTX, XLS, XLSX
- Engine: Microsoft MarkItDown
input/: Upload or place files here for CLI batch processingoutput/: Final Markdown results are stored here (CLI mode)api_upload/: Temporary upload directory for API serverapi_output/: Output directory for API serverapi_cache/: Cache directory for API server OCR processing
Use the "Clear Cache and Output" button in the Streamlit sidebar to remove all temporary and output files.
Alternatively, manually delete the cache and output directories:
rm -rf input/* output/* api_upload/* api_output/* api_cache/*To modify behavior:
- Edit
get_processors()inmain.pyto change OCR or MarkItDown settings - Update file extension lists (
OCR_EXTENSIONS,MID_EXTENSIONS) to support more types - Extend
cli.pyto handle additional formats or logging - Modify
endpoint-api.pyto add new API endpoints
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/api-key |
GET | Get current API key |
/convert |
POST | Upload and convert a document |
/convert/file-path |
POST | Convert a server-side file |
/download/{filename} |
GET | Download a converted file |
/info |
GET | Get server information |
All authenticated endpoints require the X-API-Key header:
curl -H "X-API-Key: cybermd_xxxxxxxx" http://localhost:8000/healthKey dependencies (see pyproject.toml):
fastapi+uvicorn- API serverstreamlit- Web UImarkitdown- Office file conversionopenai- OCR API clientpython-multipart- File uploads
# Place test files in input/ directory
uv run cli.pyThis project is open-source. See the LICENSE file for details.