aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorSimen A. W. Olsen <hello@simenandre.no>2026-05-28 23:54:24 +0200
committerSimen A. W. Olsen <hello@simenandre.no>2026-05-28 23:54:24 +0200
commit330a0c896970d99320529a47f186c831a6ecc4a0 (patch)
tree3dc8b3ac700a6e2715f0f81b96e7957320f6352e /README.md
parentb2d7d90add48e5cd3b644949b9b401fafc6eafbc (diff)
downloadziglang-docs-epub-330a0c896970d99320529a47f186c831a6ecc4a0.tar.gz
ziglang-docs-epub-330a0c896970d99320529a47f186c831a6ecc4a0.zip
feat: add table of content instead of sidebar
Diffstat (limited to 'README.md')
-rw-r--r--README.md23
1 files changed, 21 insertions, 2 deletions
diff --git a/README.md b/README.md
index 0a5ea18..6252224 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ Four decoupled concerns, each a small module that does one thing:
| ------------- | --------------------------------------------------------- |
| `index.zig` | discover versions + docs URLs from `download/index.json` |
| `fetch.zig` | HTTP GET via `std.http.Client` |
-| `html.zig` | transform the page HTML5 → well-formed XHTML5 |
-| `epub.zig` | assemble the EPUB3 container |
+| `html.zig` | HTML5 → XHTML5; extract the in-page TOC; drop the sidebar |
+| `epub.zig` | assemble the EPUB3 container (TOC navigation + content) |
| `zip.zig` | minimal, reproducible ZIP writer (stored entries) |
No external runtime dependencies — Zig's standard library provides HTTP and
@@ -28,6 +28,25 @@ spec-compliant at the cost of larger files. Output is **byte-for-byte
reproducible** (fixed ZIP timestamps), so CI only commits when the upstream docs
actually change.
+### Table of contents
+
+The docs page renders its table of contents in a `position: fixed` sidebar, which
+e-readers repaint on every page. The tool extracts that TOC into a proper EPUB3
+navigation document (`nav.xhtml`): it shows in the reader's built-in Contents
+menu, is the book's opening page, and each entry jumps to the matching section.
+The original fixed sidebar (and its dead version-switcher dropdown) is removed
+from the content so it no longer bleeds across pages.
+
+### Well-formedness gate
+
+Each transformed page is checked for well-formed, balanced XHTML before
+packaging; versions that fail are **skipped** (logged as `NotWellFormed`) rather
+than shipped as invalid EPUB3. A handful of older docs pages (currently 0.1.1–0.8.1
+and 0.10.x) contain malformed upstream HTML — unclosed `<p>`/`<li>` tags and
+outright typos — that can't be repaired without a full HTML5 tree-builder. Every
+EPUB this tool produces is therefore strictly well-formed; newer versions are
+picked up automatically as they are released.
+
## Usage
Requires **Zig 0.15.2**.