Convert GhBook-style HTML book files into plain text.
Project description
ghbook
Python library and CLI for converting GhBook-style HTML book files to clean .txt output while preserving book/chapter structure, page separators, and footnotes.
Install
pip install ghbook
Use as CLI
ghbook path/to/book.htm
ghbook path/to/book.htm path/to/output.txt
Use as library
from ghbook import convert_file
convert_file("path/to/book.htm", "path/to/output.txt")
Supported HTML patterns
Example HTML files are included in htmlbooks/ to demonstrate these structures.
- Book and chapter headings such as
content_h2/content_h3are emitted with##prefix. - Paragraph text is extracted from
content_paragraphandcontent_text. - Page markers like
ص: 531are converted toPAGE_SEPARATOR:. <hr class="content_hr">with followingcontent_noteblocks are emitted as:
____________
<footnote text>
Main text is preserved as-is; footnotes are appended below the separator.
PyPI trusted publisher (GitHub Actions OIDC)
This repository is prepared for publishing to PyPI using a trusted publisher workflow at:
.github/workflows/publish.yml
Configure on PyPI
- Go to PyPI project settings for
ghbookand open the publishing/trusted publisher section. - Add a GitHub trusted publisher with:
- Owner:
Ciyoku - Repository:
ghbook - Workflow filename:
publish.yml
- Owner:
- Save.
Release
Tag and push a version tag to publish:
git tag v0.1.0
git push origin v0.1.0
The workflow builds the package and publishes it to PyPI using OIDC, without API tokens.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ghbook-0.1.1.tar.gz.
File metadata
- Download URL: ghbook-0.1.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c102b6ba0e89bd34ea548bd84b818f7a307548874fa580637dff19a24cdb8a0
|
|
| MD5 |
b2f84718b42ce9a7916feb3e6fd31124
|
|
| BLAKE2b-256 |
4a6d62720383fa4ff35df601411b1396de88c4752ccd3e9c8318638492f08bf6
|
File details
Details for the file ghbook-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ghbook-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15d22feb27d42beb5fb879bd679a4b48972cdf2bfae587b84a157fd2c4c48053
|
|
| MD5 |
1a40645af6011629be8a71c6393a0122
|
|
| BLAKE2b-256 |
acaa1e400091fce0c04a29d72ba0c698fa8b1b08e358e008e37653db6ac256a2
|