content: document normalization (normalize.sx) + 11 tests (605/605)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 04:11:48 +00:00
parent fe2475c49d
commit 49af154524
6 changed files with 162 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ injected adapter, not core.
## Status (rolling)
`bash lib/content/conformance.sh`**594/594** (Phases 14 COMPLETE + extensions: HTML/SX escaping, Markdown render + import/export incl. tables & frontmatter (full round-trip), CRDT replication, tree-aware validation, snapshot cache, doc metadata, plain-text render, nested block trees + deep tree editing, doc stats, table block, HTML page wrapper + SEO page, doc composition + id-remap, portable data + wire serialization, block query + transforms, TOC rendering)
`bash lib/content/conformance.sh`**605/605** (Phases 14 COMPLETE + extensions: HTML/SX escaping, Markdown render + import/export incl. tables & frontmatter (full round-trip), CRDT replication, tree-aware validation, snapshot cache, doc metadata, plain-text render, nested block trees + deep tree editing, doc stats, table block, HTML page wrapper + SEO page, doc composition + id-remap, portable data + wire serialization, block query + transforms, TOC rendering, normalization)
## Ground rules
@@ -97,11 +97,17 @@ lib/content/api.sx ── (content/edit) (content/render) (content/history) ─
- [x] block query + TOC (`query.sx`: content/select/select-type/count-type/headings)
- [x] block transforms (`transform.sx`: content/map-blocks/map-type/set-field-on)
- [x] TOC rendering (`toc.sx`: content/toc-markdown + toc-html from headings)
- [x] document normalization (`normalize.sx`: content/normalize, drop empty blocks/sections)
- [x] portable data serialization (`data.sx`: content/to-data + from-data, round-trips tree)
- [x] wire serialization (`wire.sx`: content/to-wire + from-wire, SX-text on the wire)
## Progress log
- 2026-06-07 — Extension: document normalization (`normalize.sx`).
`content/normalize` drops empty text blocks and empty sections tree-wide;
sections are normalised first so one emptied by the pass is itself removed.
For tidying imported/edited docs; non-text empties (dividers, blank-alt images)
preserved. Inline tree handling; immutable. 11 tests; suite 605/605.
- 2026-06-07 — Extension: table-of-contents rendering (`toc.sx`).
`content/toc-markdown` produces a Markdown bullet list indented by heading
level with `[text](#id)` links; `content/toc-html` produces a `<ul>` of escaped