搜索

PythonReactSEOPDF
OpenClaw

txt-to-epub

将txt文本转换为epub文件,使用纯规则进行章节识别与分割。适用于小说、教程和一般长文,不内置AI接口。

1oid0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install 1oid/txt-to-epub

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

TXT to EPUB

Role

你是一个专门将 TXT 文本转换为 EPUB 的助手。你只做规则分章,不调用任何外部模型 API。

What This Skill Does

  1. 自动检测 TXT 编码并读取内容
  2. 基于规则识别章节标题并分章
  3. 生成带目录导航的 EPUB 文件
  4. 支持保留完整标题(默认)或清理编号前缀

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

  • --input 输入 TXT 文件路径(必填)
  • --output 输出 EPUB 路径(可选,默认同名 .epub)
  • --title 书名(可选,默认取输入文件名)
  • --author 作者(可选)
  • --language 语言,默认 zh-CN
  • --split-mode 分章模式:auto|novel|tutorial|length
  • --title-style 标题样式:full|clean,默认 full
  • --min-chapter-chars 过短章节合并阈值,默认 300
  • --chunk-chars 长度切分块大小,默认 8000
  • --verbose 输出额...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/1oid/txt-to-epub
Version
—
Commit
7ca9ccea5fd20faa600bbbe55f1c3aceaa8a3dc2
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

README

txt-to-epub

A lightweight, rule-based converter from .txt to .epub, designed for novels, tutorials, and other long-form text.

简体中文 README

Features

  • Rule-based chapter splitting (no built-in model API dependency)
  • Automatic text encoding detection (UTF-8/GBK/Big5/UTF-16, etc.)
  • Multiple heading patterns for novels and tutorials
  • Length-based fallback splitting when no headings are found
  • Standard EPUB output with navigable TOC

Project Structure

txt-to-epub/
  SKILL.md
  requirements.txt
  scripts/
    txt_to_epub.py

Installation

python3 -m pip install -r requirements.txt

Quick Start

Run in the txt-to-epub directory:

python3 scripts/txt_to_epub.py --input /path/to/book.txt

By default, the output EPUB is created next to the input TXT file with the same base name.

Common Commands

Novel mode (recommended, keep full chapter titles):

python3 scripts/txt_to_epub.py \
  --input /path/to/novel.txt \
  --split-mode novel \
  --title-style full \
  --verbose

Tutorial mode:

python3 scripts/txt_to_epub.py \
  --input /path/to/tutorial.txt \
  --split-mode tutorial \
  --title-style full

Force length-based splitting:

python3 scripts/txt_to_epub.py \
  --input /path/to/long_text.txt \
  --split-mode length \
  --chunk-chars 8000

Arguments

  • --input: Input TXT path (required)
  • --output: Output EPUB path (optional)
  • --title: Book title (optional; defaults to file name)
  • --author: Author (optional)
  • --language: Language (default: zh-CN)
  • --split-mode: auto | novel | tutorial | length
  • --title-style: full | clean (default: full)
    • full: Keep full headings, such as 第一章 旧土
    • clean: Remove numbering prefixes and keep only heading text
  • --min-chapter-chars: Merge threshold for very short chapters (default: 300)
  • --chunk-chars: Chunk size for length mode (default: 8000)
  • --verbose: Print extra...

来源内容

SKILL.md
# TXT to EPUB

## Role

你是一个专门将 TXT 文本转换为 EPUB 的助手。你只做规则分章,不调用任何外部模型 API。

## What This Skill Does

1. 自动检测 TXT 编码并读取内容
2. 基于规则识别章节标题并分章
3. 生成带目录导航的 EPUB 文件
4. 支持保留完整标题(默认)或清理编号前缀

## 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

```bash
python3 -m pip install -r /Users/loid/.claude/skills/txt-to-epub/requirements.txt
```

## Usage

最小示例:

```bash
python3 /Users/loid/.claude/skills/txt-to-epub/scripts/txt_to_epub.py \
  --input /path/to/book.txt
```

常用示例(小说):

```bash
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
```

常用示例(教程):

```bash
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

- `--input` 输入 TXT 文件路径(必填)
- `--output` 输出 EPUB 路径(可选,默认同名 `.epub`)
- `--title` 书名(可选,默认取输入文件名)
- `--author` 作者(可选)
- `--language` 语言,默认 `zh-CN`
- `--split-mode` 分章模式:`auto|novel|tutorial|length`
- `--title-style` 标题样式:`full|clean`,默认 `full`
- `--min-chapter-chars` 过短章节合并阈值,默认 `300`
- `--chunk-chars` 长度切分块大小,默认 `8000`
- `--verbose` 输出额...
README
# txt-to-epub

A lightweight, rule-based converter from `.txt` to `.epub`, designed for novels, tutorials, and other long-form text.

[简体中文 README](README.zh.md)

## Features

- Rule-based chapter splitting (no built-in model API dependency)
- Automatic text encoding detection (UTF-8/GBK/Big5/UTF-16, etc.)
- Multiple heading patterns for novels and tutorials
- Length-based fallback splitting when no headings are found
- Standard EPUB output with navigable TOC

## Project Structure

```text
txt-to-epub/
  SKILL.md
  requirements.txt
  scripts/
    txt_to_epub.py
```

## Installation

```bash
python3 -m pip install -r requirements.txt
```

## Quick Start

Run in the `txt-to-epub` directory:

```bash
python3 scripts/txt_to_epub.py --input /path/to/book.txt
```

By default, the output EPUB is created next to the input TXT file with the same base name.

## Common Commands

Novel mode (recommended, keep full chapter titles):

```bash
python3 scripts/txt_to_epub.py \
  --input /path/to/novel.txt \
  --split-mode novel \
  --title-style full \
  --verbose
```

Tutorial mode:

```bash
python3 scripts/txt_to_epub.py \
  --input /path/to/tutorial.txt \
  --split-mode tutorial \
  --title-style full
```

Force length-based splitting:

```bash
python3 scripts/txt_to_epub.py \
  --input /path/to/long_text.txt \
  --split-mode length \
  --chunk-chars 8000
```

## Arguments

- `--input`: Input TXT path (required)
- `--output`: Output EPUB path (optional)
- `--title`: Book title (optional; defaults to file name)
- `--author`: Author (optional)
- `--language`: Language (default: `zh-CN`)
- `--split-mode`: `auto | novel | tutorial | length`
- `--title-style`: `full | clean` (default: `full`)
  - `full`: Keep full headings, such as `第一章 旧土`
  - `clean`: Remove numbering prefixes and keep only heading text
- `--min-chapter-chars`: Merge threshold for very short chapters (default: `300`)
- `--chunk-chars`: Chunk size for length mode (default: `8000`)
- `--verbose`: Print extra...

相关技能

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.