360 Secure SkillHub
360 安全技能中心

EPUB to Markdown

通过内置 Python 脚本把 EPUB 电子书转换为结构化 Markdown 工作区:生成 META.md 元数据与章节导航索引、chapters/ 下的分章 Markdown 文件以及提取出的图片,便于逐章阅读、摘要与检索;可指定输出目录并控制是否覆盖。

yueeli
yueeli
热度 45.20
最近更新 2026-05-11 17:39:05
分类:效率依赖:代码执行 / 读写文件应用场景:文件转换 / 数据处理 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add epub-to-markdown
Metadata
name
epub-to-markdown
description
Convert EPUB books into an AI-ready Markdown library with a first-read META.md navigation index, per-chapter Markdown files, and extracted images. Use when the user wants to turn a .epub into Markdown for reading, summarization, analysis, retrieval, or downstream text processing, especially when the book should be explored chapter-by-chapter without loading the entire text at once.

EPUB to Markdown Conversion

Convert an EPUB into a structured Markdown workspace using the bundled script.

Run

uv run scripts/convert.py <path/to/book.epub> [output_dir]
  • Omit output_dir to write beside the EPUB as {epub_stem}/.
  • If output_dir already exists, the script stops instead of deleting it.
  • Pass --overwrite only when the user explicitly wants to replace an existing generated directory.
  • Dependencies are declared inline in the script, so uv run installs them automatically on first use.

Output

{output_dir}/
├── META.md
├── images/
└── chapters/
    ├── 001_{slug}.md
    ├── 002_{slug}.md
    └── ...
  • Read META.md first. It contains book metadata, total chapter and word counts, and a chapter index pointing at the generated files.
  • Read files in chapters/ only when the user asks about specific content.

Reply Format

After a successful conversion, report:

✅ Conversion complete

Title   : {title}
Authors : {authors}
Chapters: {total_chapters}
Words   : {total_words}
Output  : {output_dir}/

If chapter titles look wrong, the TOC is sparse, or the user needs edge-case behavior details, read references/reference.md.