Skills txt-to-epub
将txt文本转换为epub文件,使用纯规则进行章节识别与分割。适用于小说、教程和一般长文,不内置AI接口。
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/1oid/txt-to-epub" ~/.claude/skills/openclaw-skills-txt-to-epub && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/1oid/txt-to-epub" ~/.openclaw/skills/openclaw-skills-txt-to-epub && rm -rf "$T"
manifest:
skills/1oid/txt-to-epub/SKILL.mdsource content
TXT to EPUB
Role
你是一个专门将 TXT 文本转换为 EPUB 的助手。你只做规则分章,不调用任何外部模型 API。
What This Skill Does
- 自动检测 TXT 编码并读取内容
- 基于规则识别章节标题并分章
- 生成带目录导航的 EPUB 文件
- 支持保留完整标题(默认)或清理编号前缀
Split Strategy
- 支持
四种模式auto | novel | tutorial | length - 标题规则覆盖:
- 中文小说:
/第一章 ...第十回 ... - 英文结构:
/Chapter 1 ...Part 2 ... - 教程编号:
/1.2 ...2.3.4 ... - 中文序号:
一、...
- 中文小说:
- 当规则无法识别章节时,自动按长度切分为
Part 1/2/...
Title Handling
- 默认
:保留完整标题--title-style full- 例如输入是
,目录和章节标题都保持第一章 xxx第一章 xxx
- 例如输入是
- 可选
:去掉编号前缀,仅保留正文标题--title-style clean
Script Path
/Users/loid/.claude/skills/txt-to-epub/scripts/txt_to_epub.py
Install Dependencies
python3 -m pip install -r /Users/loid/.claude/skills/txt-to-epub/requirements.txt
Usage
最小示例:
python3 /Users/loid/.claude/skills/txt-to-epub/scripts/txt_to_epub.py \ --input /path/to/book.txt
常用示例(小说):
python3 /Users/loid/.claude/skills/txt-to-epub/scripts/txt_to_epub.py \ --input /path/to/novel.txt \ --output /path/to/novel.epub \ --title "我的小说" \ --author "作者名" \ --language zh-CN \ --split-mode novel \ --title-style full \ --verbose
常用示例(教程):
python3 /Users/loid/.claude/skills/txt-to-epub/scripts/txt_to_epub.py \ --input /path/to/tutorial.txt \ --split-mode tutorial \ --title-style full
Parameters
输入 TXT 文件路径(必填)--input
输出 EPUB 路径(可选,默认同名--output
).epub
书名(可选,默认取输入文件名)--title
作者(可选)--author
语言,默认--languagezh-CN
分章模式:--split-modeauto|novel|tutorial|length
标题样式:--title-style
,默认full|cleanfull
过短章节合并阈值,默认--min-chapter-chars300
长度切分块大小,默认--chunk-chars8000
输出额外信息--verbose
Interaction Rules
当用户请求转换时:
- 收集必要参数(至少
)--input - 默认使用
--title-style full - 根据文本类型建议
:--split-mode- 小说优先
novel - 教程优先
tutorial - 不确定用
auto
- 小说优先
- 执行脚本并返回:
- 输出文件路径
- 章节数
- 前几章标题预览
Limitations
- 本技能不直接调用 AI 接口
- 复杂或非结构化文本可能需要手动指定
或调整--split-mode--chunk-chars