# txt2ebook
A console tool to convert txt file to different ebook formats.
## Installation
Stable version From PyPI:
```console
python3 -m pip install txt2ebook
```
Upgrade to latest stable version:
```console
python3 -m pip install txt2ebook --upgrade
```
Latest development version from GitHub:
```console
python3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git
```
## Usage
Showing help message of command-line options:
```console
txt2ebook --help
```
<!--help !-->
```console
usage: txt2ebook [-of OUTPUT_FOLDER] [-p] [-f {epub,gmi,md,pdf,tex,txt,typ}]
[-ik INDEX_KEYWORD] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]
[-tr TRANSLATOR] [-c IMAGE_FILENAME] [-w WIDTH]
[-ff FILENAME_FORMAT] [-ps SEPARATOR] [-pz PAGE_SIZE]
[-rd REGEX] [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX]
[-ra REGEX] [-rl REGEX] [-rr REGEX REGEX] [-ct]
[-et {clean,condense,noindent}] [-vp] [-tp] [-sp] [-ss]
[-toc] [-hn] [-fw] [-rw] [-ow] [-op] [-q] [-v] [-y] [-d]
[--env] [-h] [-V]
TXT_FILENAME [EBOOK_FILENAME]
txt2ebook/tte is a cli tool to convert txt file to ebook format.
website: https://github.com/kianmeng/txt2ebook
changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
issues: https://github.com/kianmeng/txt2ebook/issues
positional arguments:
TXT_FILENAME
source text filename
EBOOK_FILENAME
converted ebook filename (default: 'TXT_FILENAME.epub')
options:
-of OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER
set default output folder (default: 'output')
-p, --purge
remove converted ebooks specified by --output-folder option (default: 'False')
-f {epub,gmi,md,pdf,tex,txt,typ}, --format {epub,gmi,md,pdf,tex,txt,typ}
ebook format (default: 'epub')
-ik INDEX_KEYWORD, --index-keyword INDEX_KEYWORD
keyword to index (default: '[]')
-t TITLE, --title TITLE
title of the ebook (default: 'None')
-l LANGUAGE, --language LANGUAGE
language of the ebook (default: 'None')
-a AUTHOR, --author AUTHOR
author of the ebook (default: '[]')
-tr TRANSLATOR, --translator TRANSLATOR
translator of the ebook (default: '[]')
-ff FILENAME_FORMAT, --filename-format FILENAME_FORMAT
the output filename format (default: TXT_FILENAME [EBOOK_FILENAME])
1 - title_authors.EBOOK_EXTENSION
2 - authors_title.EBOOK_EXTENSION
-ps SEPARATOR, --paragraph_separator SEPARATOR
paragraph separator (default: '\n\n')
-rd REGEX, --regex-delete REGEX
regex to delete word or phrase (default: '[]')
-rvc REGEX, --regex-volume-chapter REGEX
regex to parse volume and chapter header (default: by LANGUAGE)
-rv REGEX, --regex-volume REGEX
regex to parse volume header (default: by LANGUAGE)
-rc REGEX, --regex-chapter REGEX
regex to parse chapter header (default: by LANGUAGE)
-rt REGEX, --regex-title REGEX
regex to parse title of the book (default: by LANGUAGE)
-ra REGEX, --regex-author REGEX
regex to parse author of the book (default: by LANGUAGE)
-rl REGEX, --regex-delete-line REGEX
regex to delete whole line (default: '[]')
-rr REGEX REGEX, --regex-replace REGEX REGEX
regex to search and replace (default: '[]')
-tp, --test-parsing
test parsing for volume/chapter header
-ss, --sort-volume-and-chapter
short volume and chapter
-rw, --raise-on-warning
raise exception and stop parsing upon warning
-ow, --overwrite
overwrite massaged TXT_FILENAME
-op, --open
open the generated file using default program
-q, --quiet
suppress all logging
-v, --verbose
show verbosity of debugging log, use -vv, -vvv for more details
-y, --yes
yes to prompt
-d, --debug
show debugging log and stacktrace
--env
print environments information for bug reporting
-h, --help
show this help message and exit
-V, --version
show program's version number and exit
--format epub:
-c IMAGE_FILENAME, --cover IMAGE_FILENAME
cover of the ebook
-et {clean,condense,noindent}, --epub-template {clean,condense,noindent}
CSS template for epub ebook (default: 'clean')
-vp, --volume-page
generate each volume as separate page
--format pdf:
-pz PAGE_SIZE, --page-size PAGE_SIZE
page size of the ebook (default: 'a5')
--format txt:
-w WIDTH, --width WIDTH
width for line wrapping
-sp, --split-volume-and-chapter
split volume or chapter into separate file and ignore the --overwrite option
-toc, --table-of-content
add table of content
--format tex:
-ct, --clean-tex
purge artifacts generated by TeX (default: 'False')
--language zh-cn / --language zh-tw:
-hn, --header-number
convert section header from words to numbers
-fw, --fullwidth
convert ASCII character from halfwidth to fullwidth
```
<!--help !-->
Convert a txt file into epub:
```console
txt2ebook ebook.txt
```
## Copyright and License
Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.
The fish logo used in the documentation generated by Sphinx is a public domain
drawing of Troschel's parrotfish (Chlorurus troschelii Var. A.) from
<https://commons.wikimedia.org/entity/M18506436>.
18506436>.
Raw data
{
"_id": null,
"home_page": "https://github.com/kianmeng/txt2ebook",
"name": "txt2ebook",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "txt, ebook, epub, cjk",
"author": "Kian-Meng Ang",
"author_email": "kianmeng@cpan.org",
"download_url": "https://files.pythonhosted.org/packages/ff/b6/844556290f9bc8312ab714be36c7ae2ec17e49fe76ba0097ac201fd7ee48/txt2ebook-0.1.122.tar.gz",
"platform": null,
"description": "# txt2ebook\n\nA console tool to convert txt file to different ebook formats.\n\n## Installation\n\nStable version From PyPI:\n\n```console\npython3 -m pip install txt2ebook\n```\n\nUpgrade to latest stable version:\n\n```console\npython3 -m pip install txt2ebook --upgrade\n```\n\nLatest development version from GitHub:\n\n```console\npython3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git\n```\n\n## Usage\n\nShowing help message of command-line options:\n\n```console\ntxt2ebook --help\n```\n\n<!--help !-->\n\n```console\nusage: txt2ebook [-of OUTPUT_FOLDER] [-p] [-f {epub,gmi,md,pdf,tex,txt,typ}]\n [-ik INDEX_KEYWORD] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]\n [-tr TRANSLATOR] [-c IMAGE_FILENAME] [-w WIDTH]\n [-ff FILENAME_FORMAT] [-ps SEPARATOR] [-pz PAGE_SIZE]\n [-rd REGEX] [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX]\n [-ra REGEX] [-rl REGEX] [-rr REGEX REGEX] [-ct]\n [-et {clean,condense,noindent}] [-vp] [-tp] [-sp] [-ss]\n [-toc] [-hn] [-fw] [-rw] [-ow] [-op] [-q] [-v] [-y] [-d]\n [--env] [-h] [-V]\n TXT_FILENAME [EBOOK_FILENAME]\n\ntxt2ebook/tte is a cli tool to convert txt file to ebook format.\n\n website: https://github.com/kianmeng/txt2ebook\n changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md\n issues: https://github.com/kianmeng/txt2ebook/issues\n\npositional arguments:\n TXT_FILENAME\n source text filename\n EBOOK_FILENAME\n converted ebook filename (default: 'TXT_FILENAME.epub')\n\noptions:\n -of OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER\n set default output folder (default: 'output')\n -p, --purge\n remove converted ebooks specified by --output-folder option (default: 'False')\n -f {epub,gmi,md,pdf,tex,txt,typ}, --format {epub,gmi,md,pdf,tex,txt,typ}\n ebook format (default: 'epub')\n -ik INDEX_KEYWORD, --index-keyword INDEX_KEYWORD\n keyword to index (default: '[]')\n -t TITLE, --title TITLE\n title of the ebook (default: 'None')\n -l LANGUAGE, --language LANGUAGE\n language of the ebook (default: 'None')\n -a AUTHOR, --author AUTHOR\n author of the ebook (default: '[]')\n -tr TRANSLATOR, --translator TRANSLATOR\n translator of the ebook (default: '[]')\n -ff FILENAME_FORMAT, --filename-format FILENAME_FORMAT\n the output filename format (default: TXT_FILENAME [EBOOK_FILENAME])\n 1 - title_authors.EBOOK_EXTENSION\n 2 - authors_title.EBOOK_EXTENSION\n -ps SEPARATOR, --paragraph_separator SEPARATOR\n paragraph separator (default: '\\n\\n')\n -rd REGEX, --regex-delete REGEX\n regex to delete word or phrase (default: '[]')\n -rvc REGEX, --regex-volume-chapter REGEX\n regex to parse volume and chapter header (default: by LANGUAGE)\n -rv REGEX, --regex-volume REGEX\n regex to parse volume header (default: by LANGUAGE)\n -rc REGEX, --regex-chapter REGEX\n regex to parse chapter header (default: by LANGUAGE)\n -rt REGEX, --regex-title REGEX\n regex to parse title of the book (default: by LANGUAGE)\n -ra REGEX, --regex-author REGEX\n regex to parse author of the book (default: by LANGUAGE)\n -rl REGEX, --regex-delete-line REGEX\n regex to delete whole line (default: '[]')\n -rr REGEX REGEX, --regex-replace REGEX REGEX\n regex to search and replace (default: '[]')\n -tp, --test-parsing\n test parsing for volume/chapter header\n -ss, --sort-volume-and-chapter\n short volume and chapter\n -rw, --raise-on-warning\n raise exception and stop parsing upon warning\n -ow, --overwrite\n overwrite massaged TXT_FILENAME\n -op, --open\n open the generated file using default program\n -q, --quiet\n suppress all logging\n -v, --verbose\n show verbosity of debugging log, use -vv, -vvv for more details\n -y, --yes\n yes to prompt\n -d, --debug\n show debugging log and stacktrace\n --env\n print environments information for bug reporting\n -h, --help\n show this help message and exit\n -V, --version\n show program's version number and exit\n\n--format epub:\n -c IMAGE_FILENAME, --cover IMAGE_FILENAME\n cover of the ebook\n -et {clean,condense,noindent}, --epub-template {clean,condense,noindent}\n CSS template for epub ebook (default: 'clean')\n -vp, --volume-page\n generate each volume as separate page\n\n--format pdf:\n -pz PAGE_SIZE, --page-size PAGE_SIZE\n page size of the ebook (default: 'a5')\n\n--format txt:\n -w WIDTH, --width WIDTH\n width for line wrapping\n -sp, --split-volume-and-chapter\n split volume or chapter into separate file and ignore the --overwrite option\n -toc, --table-of-content\n add table of content\n\n--format tex:\n -ct, --clean-tex\n purge artifacts generated by TeX (default: 'False')\n\n--language zh-cn / --language zh-tw:\n -hn, --header-number\n convert section header from words to numbers\n -fw, --fullwidth\n convert ASCII character from halfwidth to fullwidth\n```\n\n<!--help !-->\n\nConvert a txt file into epub:\n\n```console\ntxt2ebook ebook.txt\n```\n\n## Copyright and License\n\nCopyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSoftware Foundation, either version 3 of the License, or (at your option) any\nlater version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see <https://www.gnu.org/licenses/>.\n\nThe fish logo used in the documentation generated by Sphinx is a public domain\ndrawing of Troschel's parrotfish (Chlorurus troschelii Var. A.) from\n<https://commons.wikimedia.org/entity/M18506436>.\n18506436>.\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "CLI tool to convert txt file to ebook format",
"version": "0.1.122",
"project_urls": {
"Homepage": "https://github.com/kianmeng/txt2ebook",
"Repository": "https://github.com/kianmeng/txt2ebook"
},
"split_keywords": [
"txt",
" ebook",
" epub",
" cjk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eb8166b522b3fcac46b1f3789e9c8a85aad1fa7a90dc8c9164002a793e635cd4",
"md5": "11c244498fe7b188933a31005992ed03",
"sha256": "889bc6978b409d94fe7ba6e2870dff83b8147f5d65071a8c37c65c8e8eb169f6"
},
"downloads": -1,
"filename": "txt2ebook-0.1.122-py3-none-any.whl",
"has_sig": false,
"md5_digest": "11c244498fe7b188933a31005992ed03",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 78962,
"upload_time": "2025-01-12T16:38:56",
"upload_time_iso_8601": "2025-01-12T16:38:56.282960Z",
"url": "https://files.pythonhosted.org/packages/eb/81/66b522b3fcac46b1f3789e9c8a85aad1fa7a90dc8c9164002a793e635cd4/txt2ebook-0.1.122-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ffb6844556290f9bc8312ab714be36c7ae2ec17e49fe76ba0097ac201fd7ee48",
"md5": "f26eb9cd5cc1d521328e8c082330c4cc",
"sha256": "64400b4a3c0e8dd0626079e1b6ad7cef129c807187466c67f335b246bf1e24fe"
},
"downloads": -1,
"filename": "txt2ebook-0.1.122.tar.gz",
"has_sig": false,
"md5_digest": "f26eb9cd5cc1d521328e8c082330c4cc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 43637,
"upload_time": "2025-01-12T16:38:59",
"upload_time_iso_8601": "2025-01-12T16:38:59.819184Z",
"url": "https://files.pythonhosted.org/packages/ff/b6/844556290f9bc8312ab714be36c7ae2ec17e49fe76ba0097ac201fd7ee48/txt2ebook-0.1.122.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-12 16:38:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kianmeng",
"github_project": "txt2ebook",
"github_not_found": true,
"lcname": "txt2ebook"
}