AGENT SKILL
epub-ebooklib
Build an EPUB with Python ebooklib without producing empty chapters; use whenever creating .epub files.
- License 许可
- MIT
- 最近更新
- 2026-11-08
- Stars
- ★ 927
- Forks
- 167
01 前言 Front Matter
- name
- epub-ebooklib
- description
- Build an EPUB with Python ebooklib without producing empty chapters; use whenever creating .epub files.
03 SKILL.md 正文
Building EPUBs with ebooklib
- Run with
/usr/bin/python3if the default python lacks ebooklib. - Set chapter content as BYTES with no XML declaration:
ch.content = html.encode("utf-8"), wherehtmlstarts with<html ...>and NOT<?xml ...?>. A str starting with<?xmlsilently serializes as an empty chapter. - Escape text (
html.escape) and wrap paragraphs in<p>. - Add every chapter to
book.spineand aepub.EpubNcx()/epub.EpubNav(). - Right after
epub.write_epub, verify once: unzip the file, check each chapter xhtml is larger than ~500 bytes. Fix at once if not, then stop; do not re-verify repeatedly.
04 同仓库更多 Skills
lint-py
Run lints on Python files.
★ 927
add-component
Scaffold a new React component.
★ 927
commit-helper
Generate a conventional-commit message from staged changes.
★ 927
scrape-cloudflare-site
Fetch web pages (e.g. novel chapters) that return a Cloudflare "Just a moment" page to curl or headless Chrome.
★ 927