Turns PDF, Word, PowerPoint and Excel files into Markdown or plain text with heading levels preserved where the source allows it, and refuses scanned PDFs that have no text layer instead of writing an empty file, naming the OCR alternative instead. Requires Python 3.10+ and pip install -r requirements.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-pdf2md
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Qiujiyuantiantian/dsh-pdf2md
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
A DSH skill that converts PDF, Word, PowerPoint, Excel and HTML into Markdown or plain text — and refuses scanned PDFs instead of writing an empty file.
Why this exists
The conversion libraries are not the problem. pymupdf and markitdown are both
excellent, and both will happily hand you a 0-byte .md for a scanned PDF,
because a scanned PDF has no text layer to extract. The next step in your
pipeline then consumes that empty file and produces confident nonsense.
This skill's contribution is the boundary, not the conversion:
probedecides whether a text layer exists — read-only and fast- a scanned document makes
convertexit 2 and write nothing, with the next options spelled out --format txtalways produces plain text; Markdown is never relabelled as.txt- every command emits exactly one JSON document, so output is safe to parse
Install
As a DSH plugin (recommended)
dsh plugin --profile web add dsh-pdf2md
Desktop clients use their own profile name (the default is desktop):
dsh plugin --profile desktop add dsh-pdf2md
dsh plugin add installs the package into the profile and registers it in dsh.profile.bundles automatically — verified on a fresh profile, where one command added the entry. Restart DSH and pdf2md appears in the skill catalog.
Without the dsh command, pnpm add dsh-pdf2md plus a manual entry in the profile's dsh.profile.bundles works too.
Python dependencies (required)
scripts/pdf2md.py needs Python 3.10+ plus:
<python> -m pip install -r skills/pdf2md/requirements.txt
Verify:
<python> skills/pdf2md/scripts/pdf2md.py doctor
If you do not know which interpreter to use, try in order: $PDF2MD_PYTHON,
.venv/Scripts/python.exe, .venv/bin/python, python3, python — the first
one that passes doctor is the right one.
Usage
# inspect first (read-only)
python scripts/pdf2md.py probe report.pdf
# then convert
python scripts/pdf2md.py convert report.pdf --out ./out
python scripts/pdf2md.py convert report.pdf --engine structure --pages 1-6
python scripts/pdf2md.py convert ./docs --format txt --tables-csv
| Option | Meaning |
|---|---|
--out DIR |
output directory (default: alongside the source) |
--engine auto|structure|text |
engine selection |
--format md|txt |
txt always means plain text |
--pages 1-3,7 |
PDF page selection |
--tables-csv |
also export detected tables as CSV |
The two engines
structure |
text |
|
|---|---|---|
| Library | pymupdf4llm | markitdown |
| Heading levels | preserved | flattened |
| Formats | PDF only | PDF, DOCX, PPTX, XLSX, HTML, … |
| Best for | documents you will read or cite | feeding a model, mixed formats |
Measured on one real 24-page Chinese government form: structure over 6 pages →
3,708 characters with 10 heading lines; text over all 24 pages → 18,831
characters with 0 heading lines. Neither is better; they answer different
questions.
Quality boundary
Do not promise what the format cannot deliver. See
skills/pdf2md/references/quality.md:
- merged table cells: content survives, grouping does not
- two-column layouts may interleave
- equations become Unicode fragments, not LaTeX
- scanned pages: nothing at all until OCR runs — the companion
dsh-scan2mdis the OCR step (resumable, page-addressable, with a quality report)
Sandbox note
Child processes are frequently confined to the session workspace even when the
surrounding shell is not. A PermissionError outside the workspace is a sandbox
boundary, not a broken skill — write into the workspace instead.
Development
python -m pytest tests -q # 12 tests, fixtures generated at run time
node --check lib/startup.js # bundle syntax
npm pack --dry-run # what would be published
CI runs the same three checks on Python 3.10 / 3.12 / 3.13 and Node 20.
Publish
npm publish --access public
Fill in author and repository in package.json first — they are intentionally
left blank.
Licence
MIT for this package. The conversion libraries keep their own terms: PyMuPDF is
AGPL-3.0 (not bundled here — users install it), markitdown is MIT. If you wrap
this skill in a network service, review the AGPL obligations attached to PyMuPDF
before deploying.
Links
More in this category
tw93/Mole#mole★ 77096
Official agent skill for the open-source Mole CLI (mo), a disk cleanup tool for macOS and Windows: read disk usage, preview and run cleanup, inspect installed apps, and read system health and cleanup history from Mole's JSON output. It previews with --dry-run and asks before removing anything, and leaves app uninstalls and privileged steps to the user's own terminal. The plugin ships only the skill; the CLI is installed separately.
zhu1090093659/dsh-web#packages/dsh-skill-explorer★ 10735
Skill center for the dsh web GUI: browse all loaded skills grouped by source, enable or disable model invocation, create new skills, and delete into a recoverable trash.
QingYunA/answer-me-with-html★ 6814
Answers a question with a one-page visual HTML explainer: the model writes a short Markdown draft and the bundled `am` CLI builds the page, with flow, sequence, tree, timeline and ER diagrams, tables and callouts.
iflytek/skillhub#dsh★ 5528
Browse and search a SkillHub registry and manage local skill installation, updates, and removal inside DeepSeek Harness. Targets DSH 0.2.0-rc.2 and 0.2.1-rc.2; not yet compatible with 0.2.1-rc.3.
hyhmrright/brooks-lint★ 1599
Provides six code quality skills for code review, architecture audits, technical debt, test quality, health dashboards, and remediation.
GanyuanRan/Aegis★ 1462
Software-engineering method pack for coding agents, with skills for baseline-first planning, systematic debugging, prompt hygiene, verification before completion, and repair/retirement tracking.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.