drop2md 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- drop2md-2.0.0/LICENSE +21 -0
- drop2md-2.0.0/PKG-INFO +326 -0
- drop2md-2.0.0/README.md +244 -0
- drop2md-2.0.0/pyproject.toml +182 -0
- drop2md-2.0.0/setup.cfg +4 -0
- drop2md-2.0.0/src/drop2md/__init__.py +5 -0
- drop2md-2.0.0/src/drop2md/cli.py +1079 -0
- drop2md-2.0.0/src/drop2md/config.py +180 -0
- drop2md-2.0.0/src/drop2md/converters/__init__.py +45 -0
- drop2md-2.0.0/src/drop2md/converters/epub.py +58 -0
- drop2md-2.0.0/src/drop2md/converters/html.py +101 -0
- drop2md-2.0.0/src/drop2md/converters/image.py +69 -0
- drop2md-2.0.0/src/drop2md/converters/legacy_pdf.py +148 -0
- drop2md-2.0.0/src/drop2md/converters/office.py +202 -0
- drop2md-2.0.0/src/drop2md/converters/pdf.py +283 -0
- drop2md-2.0.0/src/drop2md/dispatcher.py +121 -0
- drop2md-2.0.0/src/drop2md/enhance.py +517 -0
- drop2md-2.0.0/src/drop2md/enhance_providers.py +329 -0
- drop2md-2.0.0/src/drop2md/mcp_server.py +245 -0
- drop2md-2.0.0/src/drop2md/ollama_enhance.py +7 -0
- drop2md-2.0.0/src/drop2md/postprocess.py +130 -0
- drop2md-2.0.0/src/drop2md/py.typed +0 -0
- drop2md-2.0.0/src/drop2md/services/Info.plist.template +36 -0
- drop2md-2.0.0/src/drop2md/services/document.wflow.template +159 -0
- drop2md-2.0.0/src/drop2md/utils/__init__.py +0 -0
- drop2md-2.0.0/src/drop2md/utils/fs.py +74 -0
- drop2md-2.0.0/src/drop2md/utils/gfm.py +112 -0
- drop2md-2.0.0/src/drop2md/utils/image_extractor.py +58 -0
- drop2md-2.0.0/src/drop2md/utils/logging.py +32 -0
- drop2md-2.0.0/src/drop2md/utils/process_monitor.py +137 -0
- drop2md-2.0.0/src/drop2md/watcher.py +218 -0
- drop2md-2.0.0/src/drop2md.egg-info/PKG-INFO +326 -0
- drop2md-2.0.0/src/drop2md.egg-info/SOURCES.txt +35 -0
- drop2md-2.0.0/src/drop2md.egg-info/dependency_links.txt +1 -0
- drop2md-2.0.0/src/drop2md.egg-info/entry_points.txt +3 -0
- drop2md-2.0.0/src/drop2md.egg-info/requires.txt +68 -0
- drop2md-2.0.0/src/drop2md.egg-info/top_level.txt +1 -0
drop2md-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thomas Juul Dyhr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
drop2md-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drop2md
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: macOS document-to-markdown converter with folder watching and LLM integration
|
|
5
|
+
Author-email: Thomas Juul Dyhr <docdyhr@me.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/docdyhr/drop2md
|
|
8
|
+
Project-URL: Repository, https://github.com/docdyhr/drop2md
|
|
9
|
+
Project-URL: Issues, https://github.com/docdyhr/drop2md/issues
|
|
10
|
+
Keywords: markdown,pdf,docx,pptx,converter,llm,macos,obsidian,claude,ocr,watcher
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: MacOS X
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: watchdog>=4.0.0
|
|
27
|
+
Requires-Dist: typer>=0.21.0
|
|
28
|
+
Requires-Dist: html2text>=2024.2.26
|
|
29
|
+
Requires-Dist: python-magic>=0.4.27
|
|
30
|
+
Requires-Dist: httpx>=0.27.0
|
|
31
|
+
Requires-Dist: pdfplumber>=0.11.0
|
|
32
|
+
Requires-Dist: mcp[cli]>=2.0.0
|
|
33
|
+
Requires-Dist: psutil>=6.0.0
|
|
34
|
+
Provides-Extra: pdf-ml
|
|
35
|
+
Requires-Dist: marker-pdf>=1.6.0; extra == "pdf-ml"
|
|
36
|
+
Requires-Dist: docling>=2.84.0; extra == "pdf-ml"
|
|
37
|
+
Provides-Extra: pdf-light
|
|
38
|
+
Requires-Dist: pymupdf4llm>=1.27.2.2; extra == "pdf-light"
|
|
39
|
+
Provides-Extra: office
|
|
40
|
+
Requires-Dist: markitdown[docx]>=0.1.0; extra == "office"
|
|
41
|
+
Provides-Extra: office-images
|
|
42
|
+
Requires-Dist: python-docx>=1.1.0; extra == "office-images"
|
|
43
|
+
Requires-Dist: python-pptx>=1.0.2; extra == "office-images"
|
|
44
|
+
Provides-Extra: ocr
|
|
45
|
+
Requires-Dist: pytesseract>=0.3.13; extra == "ocr"
|
|
46
|
+
Requires-Dist: Pillow>=12.1.1; extra == "ocr"
|
|
47
|
+
Provides-Extra: openai
|
|
48
|
+
Requires-Dist: openai>=2.31.0; extra == "openai"
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: ruff==0.17.6; extra == "dev"
|
|
51
|
+
Requires-Dist: mypy>=1.20.0; extra == "dev"
|
|
52
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
53
|
+
Requires-Dist: bandit[toml]>=1.7.5; extra == "dev"
|
|
54
|
+
Requires-Dist: pip-audit>=2.7.3; extra == "dev"
|
|
55
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11" and extra == "dev"
|
|
56
|
+
Provides-Extra: test
|
|
57
|
+
Requires-Dist: pytest>=9.0.3; extra == "test"
|
|
58
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
|
|
59
|
+
Requires-Dist: pytest-mock>=3.15.1; extra == "test"
|
|
60
|
+
Requires-Dist: pytest-timeout>=2.3.1; extra == "test"
|
|
61
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11" and extra == "test"
|
|
62
|
+
Provides-Extra: all
|
|
63
|
+
Requires-Dist: marker-pdf>=1.6.0; extra == "all"
|
|
64
|
+
Requires-Dist: docling>=2.84.0; extra == "all"
|
|
65
|
+
Requires-Dist: pymupdf4llm>=1.27.2.2; extra == "all"
|
|
66
|
+
Requires-Dist: markitdown[docx]>=0.1.0; extra == "all"
|
|
67
|
+
Requires-Dist: python-docx>=1.1.0; extra == "all"
|
|
68
|
+
Requires-Dist: python-pptx>=1.0.2; extra == "all"
|
|
69
|
+
Requires-Dist: pytesseract>=0.3.13; extra == "all"
|
|
70
|
+
Requires-Dist: Pillow>=12.1.1; extra == "all"
|
|
71
|
+
Requires-Dist: openai>=2.31.0; extra == "all"
|
|
72
|
+
Requires-Dist: ruff==0.17.6; extra == "all"
|
|
73
|
+
Requires-Dist: mypy>=1.20.0; extra == "all"
|
|
74
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "all"
|
|
75
|
+
Requires-Dist: bandit[toml]>=1.7.5; extra == "all"
|
|
76
|
+
Requires-Dist: pip-audit>=2.7.3; extra == "all"
|
|
77
|
+
Requires-Dist: pytest>=9.0.3; extra == "all"
|
|
78
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "all"
|
|
79
|
+
Requires-Dist: pytest-mock>=3.15.1; extra == "all"
|
|
80
|
+
Requires-Dist: pytest-timeout>=2.3.1; extra == "all"
|
|
81
|
+
Dynamic: license-file
|
|
82
|
+
|
|
83
|
+
<div align="right">
|
|
84
|
+
|
|
85
|
+
<a href="https://railway.com?referralCode=QhjuBc">
|
|
86
|
+
|
|
87
|
+
<img width="160" src="https://raw.githubusercontent.com/docdyhr/.github/main/assets/railway-corner-v2@2x.png" alt="Deploy on Railway — $20 free credits">
|
|
88
|
+
|
|
89
|
+
</a>
|
|
90
|
+
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
# drop2md
|
|
94
|
+
|
|
95
|
+
[](https://github.com/docdyhr/drop2md/actions/workflows/ci.yml)
|
|
96
|
+
[](https://github.com/docdyhr/drop2md/releases/latest)
|
|
97
|
+
[](https://www.python.org/downloads/)
|
|
98
|
+
[](LICENSE)
|
|
99
|
+
|
|
100
|
+
**drop2md** is a macOS document-to-markdown converter that watches a drop folder
|
|
101
|
+
and automatically converts documents to clean GFM markdown — optimized for
|
|
102
|
+
Claude Desktop, Claude Code, Cowork, and any LLM-based workflow.
|
|
103
|
+
|
|
104
|
+
Drop a PDF, Word doc, PowerPoint, spreadsheet, or web page into the watch folder
|
|
105
|
+
and get a clean `.md` file with preserved tables, extracted images, and YAML
|
|
106
|
+
frontmatter in seconds.
|
|
107
|
+
|
|
108
|
+
## Features
|
|
109
|
+
|
|
110
|
+
- **Multi-format support**: PDF, DOCX, PPTX, XLSX, HTML, EPUB, PNG/JPG
|
|
111
|
+
- **Best-in-class converters**: Marker (PDF), MarkItDown (Office), html2text (HTML)
|
|
112
|
+
- **Tiered PDF conversion**: Marker → Docling → PyMuPDF4LLM → pdfplumber fallback
|
|
113
|
+
- **Table preservation**: GFM pipe tables, maintained reading order
|
|
114
|
+
- **Image extraction**: Embedded images saved separately, referenced with relative paths
|
|
115
|
+
- **YAML frontmatter**: source, date, converter, page count, quality score — great for LLM context
|
|
116
|
+
- **macOS background service**: launchd integration, survives restarts
|
|
117
|
+
- **Optional Ollama**: local LLM for image captions and table validation
|
|
118
|
+
- **Apple Silicon**: Marker uses Apple MPS for fast inference on M-series Macs
|
|
119
|
+
|
|
120
|
+
## Quick Start
|
|
121
|
+
|
|
122
|
+
### Homebrew (recommended — Apple Silicon, macOS 14+)
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
brew tap docdyhr/tap
|
|
126
|
+
brew install drop2md
|
|
127
|
+
|
|
128
|
+
# Interactive first-run wizard — sets up config, service, and Quick Action
|
|
129
|
+
drop2md setup
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### pip install (Python 3.11+, Intel or Apple Silicon)
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Install system dependencies
|
|
136
|
+
brew install pandoc tesseract
|
|
137
|
+
|
|
138
|
+
# Install drop2md (core + office support)
|
|
139
|
+
pip install 'drop2md[pdf-light,office,ocr]'
|
|
140
|
+
|
|
141
|
+
# Or install with best PDF quality (~2 GB, PyTorch + Marker)
|
|
142
|
+
pip install 'drop2md[pdf-ml,office,ocr]'
|
|
143
|
+
|
|
144
|
+
# Configure
|
|
145
|
+
cp config.toml.example config.toml
|
|
146
|
+
# Edit config.toml: set watch_dir and output_dir
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### First run
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Start watching (foreground)
|
|
153
|
+
drop2md watch
|
|
154
|
+
|
|
155
|
+
# Or install as macOS background service
|
|
156
|
+
drop2md install-service
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### One-Shot Conversion
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
drop2md convert report.pdf
|
|
163
|
+
drop2md convert presentation.pptx --output ~/Desktop/
|
|
164
|
+
drop2md convert *.docx --output ~/Documents/markdown/
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
Copy `config.toml.example` to `config.toml` and edit:
|
|
170
|
+
|
|
171
|
+
```toml
|
|
172
|
+
[paths]
|
|
173
|
+
watch_dir = "~/Documents/drop-to-md"
|
|
174
|
+
output_dir = "~/Documents/markdown-output"
|
|
175
|
+
|
|
176
|
+
[pdf]
|
|
177
|
+
use_marker = true
|
|
178
|
+
marker_device = "mps" # Apple Silicon
|
|
179
|
+
|
|
180
|
+
[ollama]
|
|
181
|
+
enabled = false # set true to enable AI enhancement
|
|
182
|
+
provider = "ollama" # "ollama" | "openai" | "gemini" | "hf"
|
|
183
|
+
model = "qwen3.5:latest"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
See [`config.toml.example`](config.toml.example) for all options.
|
|
187
|
+
|
|
188
|
+
## macOS Service
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Install and start background service
|
|
192
|
+
drop2md install-service
|
|
193
|
+
|
|
194
|
+
# Snapshot: service state, config, recent conversions, process resources
|
|
195
|
+
drop2md status
|
|
196
|
+
|
|
197
|
+
# Live monitor — refreshes every 2 seconds (Ctrl-C to quit)
|
|
198
|
+
drop2md status --watch
|
|
199
|
+
drop2md status --watch --interval 5
|
|
200
|
+
|
|
201
|
+
# Remove service
|
|
202
|
+
drop2md uninstall-service
|
|
203
|
+
|
|
204
|
+
# Logs
|
|
205
|
+
tail -f ~/Library/Logs/drop2md/drop2md.log
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The `status` command includes a **Process Resources** table showing CPU%, memory, file descriptors, and uptime for every running drop2md process (watcher, MCP server, active converters).
|
|
209
|
+
|
|
210
|
+
## Finder Quick Action
|
|
211
|
+
|
|
212
|
+
Right-click any supported file in Finder and choose **Quick Actions → drop2mark** to convert it to Markdown in-place (output saved next to the original):
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Install the Quick Action
|
|
216
|
+
drop2md install-quick-action
|
|
217
|
+
|
|
218
|
+
# Remove it
|
|
219
|
+
drop2md uninstall-quick-action
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
After installation the action may need to be enabled in **System Settings → Privacy & Security → Extensions → Finder**. A macOS notification confirms conversion results.
|
|
223
|
+
|
|
224
|
+
## Claude Desktop Integration
|
|
225
|
+
|
|
226
|
+
Claude Desktop can read PDFs directly with full vision support (tables, charts,
|
|
227
|
+
images all understood). Converted markdown is still preferred because:
|
|
228
|
+
|
|
229
|
+
- Works with Claude Code (CLI) which cannot display PDFs
|
|
230
|
+
- Reduces token usage — pre-extracted text costs less than PDF vision processing
|
|
231
|
+
- Works universally across all LLM tools (Obsidian, Cowork, any RAG pipeline)
|
|
232
|
+
- Extracted images are stored as separate files Claude can view on demand
|
|
233
|
+
|
|
234
|
+
## Output Format
|
|
235
|
+
|
|
236
|
+
Each converted file includes a YAML frontmatter block:
|
|
237
|
+
|
|
238
|
+
```markdown
|
|
239
|
+
---
|
|
240
|
+
source: "report.pdf"
|
|
241
|
+
converted: "2026-04-04T14:23:01"
|
|
242
|
+
converter: "marker"
|
|
243
|
+
pages: 12
|
|
244
|
+
quality: high
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
# Report Title
|
|
248
|
+
|
|
249
|
+
## Section 1
|
|
250
|
+
|
|
251
|
+
| Column A | Column B |
|
|
252
|
+
|---|---|
|
|
253
|
+
| value 1 | value 2 |
|
|
254
|
+
|
|
255
|
+

|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Supported Formats
|
|
259
|
+
|
|
260
|
+
| Format | Converter | Notes |
|
|
261
|
+
|---|---|---|
|
|
262
|
+
| PDF | Marker / Docling / pdfplumber | Tiered fallback; scanned PDFs detected automatically |
|
|
263
|
+
| DOCX | MarkItDown / Pandoc | Tables, headings preserved |
|
|
264
|
+
| PPTX | MarkItDown | Slide text + notes |
|
|
265
|
+
| XLSX | MarkItDown | Multiple sheets as tables |
|
|
266
|
+
| HTML | html2text / Pandoc | Links preserved |
|
|
267
|
+
| EPUB | Pandoc | Chapter structure |
|
|
268
|
+
| PNG/JPG | pytesseract + AI caption | OCR + optional AI description |
|
|
269
|
+
| RTF | Pandoc | Via OfficeConverter Pandoc fallback |
|
|
270
|
+
| ODT / ODP / ODS | Pandoc | OpenDocument formats |
|
|
271
|
+
|
|
272
|
+
## Optional AI Enhancement
|
|
273
|
+
|
|
274
|
+
When `[ollama] enabled = true`, drop2md runs an optional post-processing pass:
|
|
275
|
+
|
|
276
|
+
- **Visual Enhancement Pipeline (VEP)**: Extracted images are classified as `chart | diagram | formula | table-image | screenshot | photo` and enriched with prose descriptions, Mermaid blocks, LaTeX math, or reconstructed GFM tables
|
|
277
|
+
- **Image captions**: Images without a VEP handler get a one-sentence AI-generated alt-text
|
|
278
|
+
- **Table validation**: Broken GFM tables are auto-corrected
|
|
279
|
+
|
|
280
|
+
**A vision-capable model is required for VEP.** The default `llava-llama3:8b` works out of the box with Ollama. Text-only models (e.g. `llama3`, `qwen3.5`) silently skip image classification.
|
|
281
|
+
|
|
282
|
+
Four providers are supported (the API-key-only `claude` provider was removed):
|
|
283
|
+
|
|
284
|
+
| Provider | Model | API key env var | Notes |
|
|
285
|
+
|---|---|---|---|
|
|
286
|
+
| `ollama` | `llava-llama3:8b` (default) | — | Free, local, private |
|
|
287
|
+
| `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` | Best speed and cost |
|
|
288
|
+
| `gemini` | `gemini-2.5-flash` | `GEMINI_API_KEY` | Free tier available |
|
|
289
|
+
| `hf` | set `[openai] model` | `HF_TOKEN` | Hugging Face models through the OpenAI-compatible client |
|
|
290
|
+
|
|
291
|
+
`openai`, `gemini` and `hf` all use the OpenAI-compatible client and read their model and endpoint from `[openai]`. `[openai] base_url` defaults to OpenAI's API, so for `gemini` and `hf` set it to that provider's OpenAI-compatible endpoint (Gemini: `https://generativelanguage.googleapis.com/v1beta/openai/`; Hugging Face: `https://router.huggingface.co/v1`).
|
|
292
|
+
|
|
293
|
+
```toml
|
|
294
|
+
[ollama]
|
|
295
|
+
enabled = true
|
|
296
|
+
provider = "ollama" # "ollama" | "openai" | "gemini" | "hf"
|
|
297
|
+
model = "llava-llama3:8b" # ollama pull llava-llama3:8b
|
|
298
|
+
|
|
299
|
+
[visual]
|
|
300
|
+
enabled = true # enable the Visual Enhancement Pipeline
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
API keys are resolved in order: `DROP2MD_ENHANCE_API_KEY` (when set to a non-empty value) → `api_key` in `[ollama]` → the provider's own variable (`OPENAI_API_KEY`, then `GEMINI_API_KEY`, for `openai`; `GEMINI_API_KEY` for `gemini`; `HF_TOKEN` for `hf`).
|
|
304
|
+
|
|
305
|
+
All providers fall back gracefully — a missing key or offline service never blocks conversion.
|
|
306
|
+
|
|
307
|
+
## Development
|
|
308
|
+
|
|
309
|
+
See [CLAUDE.md](CLAUDE.md) for the full developer guide.
|
|
310
|
+
|
|
311
|
+
| Document | Contents |
|
|
312
|
+
|---|---|
|
|
313
|
+
| [`docs/ROADMAP.md`](docs/ROADMAP.md) | Versioned milestones, competitive position, architecture decisions |
|
|
314
|
+
| [`docs/PRD.md`](docs/PRD.md) | Product requirements, personas, feature checklist |
|
|
315
|
+
| [`docs/testing.md`](docs/testing.md) | Full testing reference |
|
|
316
|
+
| [`docs/mcp_integration.md`](docs/mcp_integration.md) | Claude Desktop MCP setup |
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
pip install -e ".[dev,test]"
|
|
320
|
+
pytest
|
|
321
|
+
ruff check src/ tests/
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## License
|
|
325
|
+
|
|
326
|
+
MIT — see [LICENSE](LICENSE)
|
drop2md-2.0.0/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<div align="right">
|
|
2
|
+
|
|
3
|
+
<a href="https://railway.com?referralCode=QhjuBc">
|
|
4
|
+
|
|
5
|
+
<img width="160" src="https://raw.githubusercontent.com/docdyhr/.github/main/assets/railway-corner-v2@2x.png" alt="Deploy on Railway — $20 free credits">
|
|
6
|
+
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
# drop2md
|
|
12
|
+
|
|
13
|
+
[](https://github.com/docdyhr/drop2md/actions/workflows/ci.yml)
|
|
14
|
+
[](https://github.com/docdyhr/drop2md/releases/latest)
|
|
15
|
+
[](https://www.python.org/downloads/)
|
|
16
|
+
[](LICENSE)
|
|
17
|
+
|
|
18
|
+
**drop2md** is a macOS document-to-markdown converter that watches a drop folder
|
|
19
|
+
and automatically converts documents to clean GFM markdown — optimized for
|
|
20
|
+
Claude Desktop, Claude Code, Cowork, and any LLM-based workflow.
|
|
21
|
+
|
|
22
|
+
Drop a PDF, Word doc, PowerPoint, spreadsheet, or web page into the watch folder
|
|
23
|
+
and get a clean `.md` file with preserved tables, extracted images, and YAML
|
|
24
|
+
frontmatter in seconds.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Multi-format support**: PDF, DOCX, PPTX, XLSX, HTML, EPUB, PNG/JPG
|
|
29
|
+
- **Best-in-class converters**: Marker (PDF), MarkItDown (Office), html2text (HTML)
|
|
30
|
+
- **Tiered PDF conversion**: Marker → Docling → PyMuPDF4LLM → pdfplumber fallback
|
|
31
|
+
- **Table preservation**: GFM pipe tables, maintained reading order
|
|
32
|
+
- **Image extraction**: Embedded images saved separately, referenced with relative paths
|
|
33
|
+
- **YAML frontmatter**: source, date, converter, page count, quality score — great for LLM context
|
|
34
|
+
- **macOS background service**: launchd integration, survives restarts
|
|
35
|
+
- **Optional Ollama**: local LLM for image captions and table validation
|
|
36
|
+
- **Apple Silicon**: Marker uses Apple MPS for fast inference on M-series Macs
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Homebrew (recommended — Apple Silicon, macOS 14+)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
brew tap docdyhr/tap
|
|
44
|
+
brew install drop2md
|
|
45
|
+
|
|
46
|
+
# Interactive first-run wizard — sets up config, service, and Quick Action
|
|
47
|
+
drop2md setup
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### pip install (Python 3.11+, Intel or Apple Silicon)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Install system dependencies
|
|
54
|
+
brew install pandoc tesseract
|
|
55
|
+
|
|
56
|
+
# Install drop2md (core + office support)
|
|
57
|
+
pip install 'drop2md[pdf-light,office,ocr]'
|
|
58
|
+
|
|
59
|
+
# Or install with best PDF quality (~2 GB, PyTorch + Marker)
|
|
60
|
+
pip install 'drop2md[pdf-ml,office,ocr]'
|
|
61
|
+
|
|
62
|
+
# Configure
|
|
63
|
+
cp config.toml.example config.toml
|
|
64
|
+
# Edit config.toml: set watch_dir and output_dir
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### First run
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Start watching (foreground)
|
|
71
|
+
drop2md watch
|
|
72
|
+
|
|
73
|
+
# Or install as macOS background service
|
|
74
|
+
drop2md install-service
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### One-Shot Conversion
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
drop2md convert report.pdf
|
|
81
|
+
drop2md convert presentation.pptx --output ~/Desktop/
|
|
82
|
+
drop2md convert *.docx --output ~/Documents/markdown/
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Configuration
|
|
86
|
+
|
|
87
|
+
Copy `config.toml.example` to `config.toml` and edit:
|
|
88
|
+
|
|
89
|
+
```toml
|
|
90
|
+
[paths]
|
|
91
|
+
watch_dir = "~/Documents/drop-to-md"
|
|
92
|
+
output_dir = "~/Documents/markdown-output"
|
|
93
|
+
|
|
94
|
+
[pdf]
|
|
95
|
+
use_marker = true
|
|
96
|
+
marker_device = "mps" # Apple Silicon
|
|
97
|
+
|
|
98
|
+
[ollama]
|
|
99
|
+
enabled = false # set true to enable AI enhancement
|
|
100
|
+
provider = "ollama" # "ollama" | "openai" | "gemini" | "hf"
|
|
101
|
+
model = "qwen3.5:latest"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
See [`config.toml.example`](config.toml.example) for all options.
|
|
105
|
+
|
|
106
|
+
## macOS Service
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Install and start background service
|
|
110
|
+
drop2md install-service
|
|
111
|
+
|
|
112
|
+
# Snapshot: service state, config, recent conversions, process resources
|
|
113
|
+
drop2md status
|
|
114
|
+
|
|
115
|
+
# Live monitor — refreshes every 2 seconds (Ctrl-C to quit)
|
|
116
|
+
drop2md status --watch
|
|
117
|
+
drop2md status --watch --interval 5
|
|
118
|
+
|
|
119
|
+
# Remove service
|
|
120
|
+
drop2md uninstall-service
|
|
121
|
+
|
|
122
|
+
# Logs
|
|
123
|
+
tail -f ~/Library/Logs/drop2md/drop2md.log
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The `status` command includes a **Process Resources** table showing CPU%, memory, file descriptors, and uptime for every running drop2md process (watcher, MCP server, active converters).
|
|
127
|
+
|
|
128
|
+
## Finder Quick Action
|
|
129
|
+
|
|
130
|
+
Right-click any supported file in Finder and choose **Quick Actions → drop2mark** to convert it to Markdown in-place (output saved next to the original):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Install the Quick Action
|
|
134
|
+
drop2md install-quick-action
|
|
135
|
+
|
|
136
|
+
# Remove it
|
|
137
|
+
drop2md uninstall-quick-action
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
After installation the action may need to be enabled in **System Settings → Privacy & Security → Extensions → Finder**. A macOS notification confirms conversion results.
|
|
141
|
+
|
|
142
|
+
## Claude Desktop Integration
|
|
143
|
+
|
|
144
|
+
Claude Desktop can read PDFs directly with full vision support (tables, charts,
|
|
145
|
+
images all understood). Converted markdown is still preferred because:
|
|
146
|
+
|
|
147
|
+
- Works with Claude Code (CLI) which cannot display PDFs
|
|
148
|
+
- Reduces token usage — pre-extracted text costs less than PDF vision processing
|
|
149
|
+
- Works universally across all LLM tools (Obsidian, Cowork, any RAG pipeline)
|
|
150
|
+
- Extracted images are stored as separate files Claude can view on demand
|
|
151
|
+
|
|
152
|
+
## Output Format
|
|
153
|
+
|
|
154
|
+
Each converted file includes a YAML frontmatter block:
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
---
|
|
158
|
+
source: "report.pdf"
|
|
159
|
+
converted: "2026-04-04T14:23:01"
|
|
160
|
+
converter: "marker"
|
|
161
|
+
pages: 12
|
|
162
|
+
quality: high
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
# Report Title
|
|
166
|
+
|
|
167
|
+
## Section 1
|
|
168
|
+
|
|
169
|
+
| Column A | Column B |
|
|
170
|
+
|---|---|
|
|
171
|
+
| value 1 | value 2 |
|
|
172
|
+
|
|
173
|
+

|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Supported Formats
|
|
177
|
+
|
|
178
|
+
| Format | Converter | Notes |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| PDF | Marker / Docling / pdfplumber | Tiered fallback; scanned PDFs detected automatically |
|
|
181
|
+
| DOCX | MarkItDown / Pandoc | Tables, headings preserved |
|
|
182
|
+
| PPTX | MarkItDown | Slide text + notes |
|
|
183
|
+
| XLSX | MarkItDown | Multiple sheets as tables |
|
|
184
|
+
| HTML | html2text / Pandoc | Links preserved |
|
|
185
|
+
| EPUB | Pandoc | Chapter structure |
|
|
186
|
+
| PNG/JPG | pytesseract + AI caption | OCR + optional AI description |
|
|
187
|
+
| RTF | Pandoc | Via OfficeConverter Pandoc fallback |
|
|
188
|
+
| ODT / ODP / ODS | Pandoc | OpenDocument formats |
|
|
189
|
+
|
|
190
|
+
## Optional AI Enhancement
|
|
191
|
+
|
|
192
|
+
When `[ollama] enabled = true`, drop2md runs an optional post-processing pass:
|
|
193
|
+
|
|
194
|
+
- **Visual Enhancement Pipeline (VEP)**: Extracted images are classified as `chart | diagram | formula | table-image | screenshot | photo` and enriched with prose descriptions, Mermaid blocks, LaTeX math, or reconstructed GFM tables
|
|
195
|
+
- **Image captions**: Images without a VEP handler get a one-sentence AI-generated alt-text
|
|
196
|
+
- **Table validation**: Broken GFM tables are auto-corrected
|
|
197
|
+
|
|
198
|
+
**A vision-capable model is required for VEP.** The default `llava-llama3:8b` works out of the box with Ollama. Text-only models (e.g. `llama3`, `qwen3.5`) silently skip image classification.
|
|
199
|
+
|
|
200
|
+
Four providers are supported (the API-key-only `claude` provider was removed):
|
|
201
|
+
|
|
202
|
+
| Provider | Model | API key env var | Notes |
|
|
203
|
+
|---|---|---|---|
|
|
204
|
+
| `ollama` | `llava-llama3:8b` (default) | — | Free, local, private |
|
|
205
|
+
| `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` | Best speed and cost |
|
|
206
|
+
| `gemini` | `gemini-2.5-flash` | `GEMINI_API_KEY` | Free tier available |
|
|
207
|
+
| `hf` | set `[openai] model` | `HF_TOKEN` | Hugging Face models through the OpenAI-compatible client |
|
|
208
|
+
|
|
209
|
+
`openai`, `gemini` and `hf` all use the OpenAI-compatible client and read their model and endpoint from `[openai]`. `[openai] base_url` defaults to OpenAI's API, so for `gemini` and `hf` set it to that provider's OpenAI-compatible endpoint (Gemini: `https://generativelanguage.googleapis.com/v1beta/openai/`; Hugging Face: `https://router.huggingface.co/v1`).
|
|
210
|
+
|
|
211
|
+
```toml
|
|
212
|
+
[ollama]
|
|
213
|
+
enabled = true
|
|
214
|
+
provider = "ollama" # "ollama" | "openai" | "gemini" | "hf"
|
|
215
|
+
model = "llava-llama3:8b" # ollama pull llava-llama3:8b
|
|
216
|
+
|
|
217
|
+
[visual]
|
|
218
|
+
enabled = true # enable the Visual Enhancement Pipeline
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
API keys are resolved in order: `DROP2MD_ENHANCE_API_KEY` (when set to a non-empty value) → `api_key` in `[ollama]` → the provider's own variable (`OPENAI_API_KEY`, then `GEMINI_API_KEY`, for `openai`; `GEMINI_API_KEY` for `gemini`; `HF_TOKEN` for `hf`).
|
|
222
|
+
|
|
223
|
+
All providers fall back gracefully — a missing key or offline service never blocks conversion.
|
|
224
|
+
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
See [CLAUDE.md](CLAUDE.md) for the full developer guide.
|
|
228
|
+
|
|
229
|
+
| Document | Contents |
|
|
230
|
+
|---|---|
|
|
231
|
+
| [`docs/ROADMAP.md`](docs/ROADMAP.md) | Versioned milestones, competitive position, architecture decisions |
|
|
232
|
+
| [`docs/PRD.md`](docs/PRD.md) | Product requirements, personas, feature checklist |
|
|
233
|
+
| [`docs/testing.md`](docs/testing.md) | Full testing reference |
|
|
234
|
+
| [`docs/mcp_integration.md`](docs/mcp_integration.md) | Claude Desktop MCP setup |
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
pip install -e ".[dev,test]"
|
|
238
|
+
pytest
|
|
239
|
+
ruff check src/ tests/
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT — see [LICENSE](LICENSE)
|