Nico0713520 / dsh-doc-to-markdown

목록에 있음

Convert PDF/DOCX to Markdown. Chinese-PDF optimized (NFKC), Windows-first. dsh / Claude Code / OpenClaw compatible SKILL.md skill.

master스킬 소스 보기

설치

npx -y @deepseek-ai/dsh plugin --profile web add github:Nico0713520/dsh-doc-to-markdown

이 설치 명령은 GitHub 저장소 주소에서 생성된 확인되지 않은 시작점입니다.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 66b2328동기화 2026. 8. 18.

dsh-doc-to-markdown

Node Python (PDF only) Platform License: MIT Tests

Convert PDF & Word documents to clean, LLM-friendly Markdown. Deterministic rules — no AI calls, no tokens, no cost.

中文用户请看 下方速览


Why this one

markitdownraw pymupdf4llmdsh-doc-to-markdown
Chinese PDF font glitches (, )✅ NFKC normalization + rescue
Windows Chinese/space paths⚠️⚠️ argv encoding bugs✅ temp-file arg passing
Scanned PDF detection❌ silent garbage✅ explicit "needs OCR" report
Path traversal safetyn/a✅ built-in guard
Agent-friendly output❌ human text✅ JSON stdout contract
DOCX without Python❌ needs Pythonn/a✅ pure Node (mammoth)

One-line pitch: it's the converter that survives real-world Chinese PDFs and Windows paths, and speaks JSON to your agent.

Demo

Input: a real-world Chinese PDF (exported notes with tables)

# 输入标题
## Cat Wu:AI 时代,产品经理的工作方式已被彻底重构
...

Output Markdown (actual conversion, see examples/):

## 三个工具的分工架构:按职责层级划分

|工具|职责层级|权限范围|干什么|
|---|---|---|---|
|Claude.ai|大脑层(思维)|最小:纯对话|想策略、讨论棘手问题|
|Claude Code|执行层(动手)|中等:代码域|写原型、跑脚本|
|Cowork|管家层(系统操作)|最大:跨应用跨系统|清邮件、管待办、做PPT|

判断标准不是"这是什么任务",而是 **"我要什么输出"**。

Headings, tables, bold, lists — all preserved. Zero garbled characters.

Quick start

git clone https://github.com/Nico0713520/dsh-doc-to-markdown
cd dsh-doc-to-markdown
npm install

# DOCX works immediately (pure Node)
node scripts/convert.cjs "论文.docx" -o 论文.md

# PDF needs Python once:
pip install pymupdf4llm
node scripts/convert.cjs "报告.pdf" --stdout

JSON result contract (parse this in your agent):

{
  "ok": true,
  "format": "pdf",
  "input": "E:\\docs\\报告.pdf",
  "output": "E:\\docs\\报告.md",
  "warnings": []
}

Failure is also structured — show error to the user, never retry blindly:

{ "ok": false, "error": "This PDF appears to be a scanned document (no text layer). OCR is required." }

Engine routing

FormatEngineFallback
.docxmammoth + turndown (pure Node)
.pdf (text layer)PyMuPDF4LLM via Python subprocessclear setup hint if Python missing
.pdf (scanned)detected via text-layer probeexplicit "needs OCR" error

Install as a skill

dsh / Claude Code / OpenClaw — this repo is a standard SKILL.md package. Point your skill provider at this repo (or clone into your skills directory); SKILL.md frontmatter handles activation triggers:

  • "convert this PDF/Word to Markdown"
  • “把 PDF/Word 转 markdown”、“提取文档内容”

中文速览

把 PDF / Word 转成干净的 Markdown,纯规则转换,不调用 AI、零成本。

  • 中文 PDF 专项优化:NFKC 归一化解决 CID 字体的兼容字形()和乱码(),这是 markitdown 等上游工具的盲区
  • Windows 一等公民:中文路径、空格路径、子进程编码坑全部处理
  • 表格友好:DOCX 表格转 GitHub 风格管道表格,标题层级完整保留
  • Agent 契约:stdout 输出结构化 JSON,成功失败都有明确字段
  • 扫描件识别:无文字层的扫描 PDF 会明确报告需要 OCR,不会静默输出垃圾

用法:npm installnode scripts/convert.cjs 文件.pdf -o 输出.md(PDF 需 pip install pymupdf4llm

Tests

npm test   # 10/10: happy paths, Chinese filenames, traversal guard, degradation

Roadmap

  • XLSX / PPTX via markitdown (optional dependency)
  • Scanned-PDF OCR pipeline (vision API, opt-in)
  • Two-column academic PDF layout heuristics

License

MIT

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

테스트감지됨
예제감지됨

저장소 정보

언어
JavaScript
라이선스
MIT
최신 릴리스
v0.1.0
마지막 업데이트
2026. 8. 17. PM 4:27

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.