AgentStack
SKILL verified MIT Self-run

Pdf To Markdown

skill-life-is-blue-agent-skills-pdf-to-markdown · by life-is-blue

PDF 转 Markdown 操作协议。用于宿主项目已经提供 pdf2md 命令时,通过 pdfjs-dist 提取 PDF 文本并按启发式规则还原 Markdown;触发于 PDF 文本抽取、PDF 转 Markdown、中文段落还原等请求。

No reviews yet
0 installs
2 views
0.0% view→install

Install

$ agentstack add skill-life-is-blue-agent-skills-pdf-to-markdown

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Pdf To Markdown? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

将 PDF 文件转换为结构化 Markdown 文本。

> 本仓库只提供操作协议,不包含 pdf2md 实现。先确认宿主项目提供对应命令;若 > 不存在,停止执行并向用户说明缺少实现,不要暗示复制本 Skill 即可运行。

预检

test -f package.json
bun run pdf2md --help

用法

bun run pdf2md  [password]

输出文件自动生成在 PDF 同目录,扩展名替换为 .md

参数

| 参数 | 必需 | 说明 | |------|------|------| | ` | 是 | PDF 文件路径 | | [password]` | 否 | 加密 PDF 的密码 |

依赖

bun add pdfjs-dist

仅依赖 pdfjs-dist(Mozilla PDF.js),无其他外部依赖。

转换流程

PDF → 提取文本项 → 按 Y 坐标组行 → 启发式段落合并 → Markdown

| 步骤 | 函数 | 说明 | |------|------|------| | 提取 | extractPdfText() | 解析 PDF 页面,过滤页眉页脚、页码 | | 组行 | groupTextIntoLines() | 按 Y 坐标聚合分散文本为视觉行 | | 组装 | assembleMarkdown() | 判断段落边界,输出 Markdown |

可调参数

脚本内 CONFIG 对象控制启发式行为,按需调整:

| 参数 | 默认值 | 说明 | |------|--------|------| | lineYTolerance | 2.0 | 同行文本的垂直容差(px) | | paraGapMultiplier | 1.5 | 段落间隙 = 中位行距 × 此倍数 | | shortLineRatio | 0.85 | 行宽


## 局限

- 纯文本提取,不处理图片和表格
- 启发式段落检测,复杂排版(多栏、混排)可能需要调 CONFIG
- 中文优化:中文拼接不加空格,英文拼接加空格

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [life-is-blue](https://github.com/life-is-blue)
- **Source:** [life-is-blue/agent-skills](https://github.com/life-is-blue/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.