← 返回 Skills 市场
622
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install ebook-to-md
功能描述
Convert PDF/PNG/JPEG/MOBI/EPUB to Markdown. Uses Baidu OCR only. Use when 扫描PDF转Markdown、pdf ocr、图像识别、电子书转Markdown、ebook to markdown.
使用说明 (SKILL.md)
ebook_to_md Skill
将 PDF、图片、MOBI、EPUB 转为 Markdown。仅使用百度 OCR。
输入格式
- PDF:扫描版/图像型 PDF
- PNG/JPEG:单张图片
- MOBI/EPUB:需安装 Calibre,先转 PDF 再处理
图片 OCR 输出会自动添加 Markdown 分段:首行若为短标题则转为 ##,对话段落前插入空行。
输出格式
仅输出 Markdown(.md)。
参数
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| input_path | string | yes | - | 文档路径(pdf/png/jpeg/mobi/epub)或 base64 图片 |
| output_path | string | no | - | 输出文件路径 |
| ocr_backend | string | no | "baidu" | 保留参数,仅支持百度 |
| inline_images | bool | no | true | 图片是否 base64 内联 |
快速开始
# PDF 转 Markdown(百度 OCR)
python scripts/ebook_to_md.py --input_path=./scanned.pdf
# 图片转 Markdown
python scripts/ebook_to_md.py --input_path=./screenshot.png
# 指定输出路径
python scripts/ebook_to_md.py --input_path=./report.pdf --output_path=./report.md
依赖
Python
pip install requests
系统
- Calibre(mobi/epub):
brew install calibre - 百度 OCR:设置
BAIDU_OCR_API_KEY、BAIDU_OCR_SECRET_KEY
使用示例
百度 OCR(默认)
from skills.ebook_to_md import main
main(input_path='./report.pdf', output_path='./report.md')
main(input_path='./image.png') # 图片识别
MOBI/EPUB(需 Calibre)
main(input_path='./book.epub', output_path='./book.md')
main(input_path='./book.mobi', output_path='./book.md')
返回格式
成功:返回字符串,含预览;若指定 output_path 则写入文件。 失败:返回 "错误: ..."
相关
- pdf_to_markdown:原生文本 PDF 转换(docling)
安全使用建议
This skill will upload the documents you give it (PDFs, images, converted EPUB/MOBI) to Baidu OCR/document-parser services to produce Markdown. If those documents contain sensitive or private information, do not use this skill unless you are comfortable sending that data to Baidu. Also note a metadata mismatch: the registry lists no required environment variables, but the SKILL.md and code require BAIDU_OCR_API_KEY and BAIDU_OCR_SECRET_KEY — verify that you supply credentials knowingly. If you need offline processing or stronger privacy guarantees, prefer a tool that does OCR locally (e.g., Tesseract/PaddleOCR run locally) or review the code thoroughly before running. Finally, review any fixtures or tests if you plan to run them (they may try to access Calibre or skip tests if keys are absent).
功能分析
Type: OpenClaw Skill
Name: ebook-to-md
Version: 1.0.0
The skill `ebook-to-md` is designed to convert various document types to Markdown using Baidu OCR. It utilizes `subprocess.run` to invoke `ebook-convert` (Calibre) for MOBI/EPUB files and `requests` for Baidu OCR API calls and image downloads. The use of `subprocess.run` with a list of arguments for `ebook-convert` (in `scripts/ebook_to_md.py`) correctly prevents direct shell injection from user-controlled input paths. Environment variables `BAIDU_OCR_API_KEY` and `BAIDU_OCR_SECRET_KEY` are accessed as expected for API authentication. File system operations (reading input, writing output, creating temp files) are within the stated purpose and use safe Python `pathlib` and `tempfile` methods. No evidence of prompt injection in `SKILL.md`, unauthorized data exfiltration, persistence mechanisms, or other malicious intent was found.
能力评估
Purpose & Capability
The skill's stated purpose (convert scanned PDFs/images/epub/mobi to Markdown using Baidu OCR) matches the implementation: the code calls Baidu OCR and a Baidu document parser and can convert MOBI/EPUB via Calibre. However the registry metadata declares no required environment variables or primary credential while SKILL.md and the code clearly require BAIDU_OCR_API_KEY and BAIDU_OCR_SECRET_KEY. This metadata omission is an incoherence worth noting.
Instruction Scope
SKILL.md instructs the agent to run the included script and to set Baidu OCR credentials. The implementation uploads user files (PDFs/images/ebooks converted to PDF) to Baidu endpoints (OAuth token, OCR endpoint, paddle-vl parser) and downloads parser results and images. That means user documents are transmitted to an external service (Baidu). The instructions and code do not provide strong warnings about this privacy/exfiltration risk. The code also fetches image URLs found in parser-generated HTML, which could trigger additional outbound network requests.
Install Mechanism
No install spec is provided (instruction-only plus shipped Python scripts). No arbitrary remote downloads or package installs beyond normal Python deps (requests) and optional Calibre. This is lower risk from an installation/execution provenance perspective.
Credentials
Functionally the skill needs Baidu API credentials (BAIDU_OCR_API_KEY, BAIDU_OCR_SECRET_KEY) to work; SKILL.md documents this and the tests skip OCR cases if these are unset. The registry metadata, however, lists no required env vars and declares no primary credential — an inconsistency that could mislead users into installing without realizing a cloud credential is required. No other unrelated secrets are requested.
Persistence & Privilege
The skill does not request persistent/always-on inclusion and does not modify other skills or system-wide settings. It does optionally load a .env file via python-dotenv if present (standard behavior), but this is limited and expected for a script that needs API keys.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ebook-to-md - 安装完成后,直接呼叫该 Skill 的名称或使用
/ebook-to-md触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
常见问题
ebook-to-md 是什么?
Convert PDF/PNG/JPEG/MOBI/EPUB to Markdown. Uses Baidu OCR only. Use when 扫描PDF转Markdown、pdf ocr、图像识别、电子书转Markdown、ebook to markdown. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 622 次。
如何安装 ebook-to-md?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install ebook-to-md」即可一键安装,无需额外配置。
ebook-to-md 是免费的吗?
是的,ebook-to-md 完全免费(开源免费),可自由下载、安装和使用。
ebook-to-md 支持哪些平台?
ebook-to-md 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 ebook-to-md?
由 whille(@whille)开发并维护,当前版本 v1.0.0。
推荐 Skills