feat(text): plain-text (.txt) renderer

makeTextBook: UTF-8 decode (BOM stripped), blank-line paragraph split,
hard-wrapped lines joined (natural reflow under font-size changes), HTML
escaped, sections capped at ~150KB at paragraph boundaries (small Part N
TOC, avoids one giant DOM). Sections expose load/createDocument/size per
the reflowable interface; positions for txt books are percentage-based
(sections get fake CFIs from index, same as other non-EPUB books).

makeBook: dispatches text/plain or .txt in the final non-zip/non-pdf
branch. EPUB/PDF/CBZ/MOBI/FB2 routing untouched.

Tests: offline node harness (isText, paragraph join/split, escaping,
section capping, TOC shape, dispatch incl. zip-still-routes-to-EPUB).
This commit is contained in:
John O'Keefe
2026-09-30 15:12:05 -04:00
parent e16530ad86
commit cd2fbf278e
3 changed files with 86 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "foliate-js",
"version": "0.1.0",
"version": "0.2.0",
"description": "Render e-books in the browser",
"repository": {
"type": "git",