txt2epub-next
txt2epub-next is a command-line converter for turning TXT novels and other long-form text into EPUB books. It is designed for common Chinese TXT sources as well as English chapter headings, and has no GUI dependency.
Requirements
- Python 3.10 or newer
Install
Install the published package and its command-line entry point:
python -m pip install txt2epub-next
For local development, install an editable checkout instead:
python -m pip install -e .
Convert a book
txt2epub-next convert --input .\novel.txt
The EPUB is written beside the input file by default. Set its metadata or destination when needed:
txt2epub-next convert `
--input .\novel.txt `
--output .\novel.epub `
--title "My Novel" `
--author "Author" `
--language zh `
--cover .\cover.png
For safety, an existing output file is not replaced unless --overwrite is supplied. The output path may not be the input path. The Python API follows the same rule and requires overwrite=True for an existing destination.
Wrapped prose is reflowed within each paragraph for comfortable reading at different font sizes. Use --preserve-line-breaks for poetry or preformatted text where every source line break matters.
When a cover is supplied, it is the first page. It is followed by a title page with the title, author, character count, and chapter count. Neither front page is listed as a table-of-contents entry.
If a TXT header contains fields such as 书名:, 作者:, and 简介:, they are used automatically. For other sources, pass --description "..." or --description-file .\description.txt to add a description to the title page and EPUB metadata.
After installing an editable checkout, the module can also be run with:
python -m txt2epub_next convert --input .\novel.txt
Run txt2epub-next convert --help for the complete option list. --encoding can force a known input encoding; otherwise the converter tries UTF-8, GB18030, GBK, and automatic detection.
Chapter recognition
The converter recognises common chapter forms, including:
- Chinese headings such as
第一章 标题,第二回 标题,第 十二 章 标题, and012 标题. - Volume headings such as
第一卷 标题and【第一卷:标题】. - Numbered headings such as
001 [标题]and1. Title. - English
Chapter,Book,Part, andVolumeheadings. - Special sections such as
序章,楔子,前言,终章,尾声,后记,附录, and番外.
It also removes repeated title-only tables of contents, converts common scraped HTML paragraph tags, and decodes HTML entities such as &. Decimal numbers and timestamps are deliberately not treated as chapter headings.
If no reliable chapter layout is found, the source is kept as one EPUB chapter instead of splitting ordinary paragraphs incorrectly.
Development checks
Install the development tool and run the available checks:
python -m pip install ruff
make check
To scan TXT sources for HTML markup, entities, replacement characters, and invalid XML control characters:
python scripts\check_txt_compatibility.py tests
Publishing
Build a source distribution and wheel, then validate the package metadata:
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
Upload the validated artifacts to PyPI with an API token:
python -m twine upload dist/*
License
This project is released under the MIT License.
Metadata
Release files for txt2epub-next 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| txt2epub_next-1.0.0.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| txt2epub_next-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.6 kB
Release files / txt2epub_next-1.0.0.tar.gz
| Download URL | txt2epub_next-1.0.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8a21856d7bc850c8a4581dc650eed85cd9a42d780569d08b51a9aa69cc3b3fb
|
|
BLAKE2b-256 checksum How to use checksums |
edb1a0c4e5fe1ad3dd50d78036dc99658400ae43f7c7560e2fe139fef165444c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.
Transparency logRelease files / txt2epub_next-1.0.0-py3-none-any.whl
| Download URL | txt2epub_next-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4da27b44dc2bc47ad4bde6d6dfff0673fa8e449e92169863acd2a036d3b67650
|
|
BLAKE2b-256 checksum How to use checksums |
9fa53aa657745bbed2dfe25a61b3b1978f0a6ecdf83b5f86a7fd0bf421fcb7dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.
Transparency log