Grilling: pivot reading renderer to apex HTML pipeline #73

Closed
opened 2026-10-06 15:14:06 +02:00 by AlexKucera · 1 comment
Owner

Part of #20

Question

Pivot the reading renderer from hand-rolled TextKit to apex → HTML → WKWebView + our CSS? Edit mode stays TextKit (ADR-0010 mode B untouched); only the reading half is in play. Resolves: the pivot verdict itself, apex bundling strategy, fate of the TextKit reading renderer (+ the known stale-flow defect), the source-position mapping mechanism for click-to-edit/scroll-sync, and the execution-extension of this map (spike → verdict ADR → rebuild chain replacing the TextKit renderer work, with #72 remaining the terminal gate).

Facts pinned 2026-10-06 (probed live, apex 1.1.17 via brew):

  • License: MIT — GPL-3.0-compatible, bundling/vendoring unproblematic.
  • Latency: kitchen-sink.md (1.4K) → 2.2KB HTML in 17 ms wall including subprocess spawn; PERF-3k (21K) → 23.6KB in 19 ms. Subprocess is a non-issue.
  • Coverage: nested lists, 1. 1. 1. auto-renumbering, table alignment, quotes, fenced code all render correctly — #69's entire rendered scope plus footnotes/math/metadata we never hand-rolled.
  • No source positions in any output format (HTML, pandoc JSON AST, ast-json): click-to-edit and scroll-sync must use our blank-line chunker as a post-pass stamping data-source-line on top-level elements — paragraph-level granularity, matching #68's "caret at paragraph start" contract.
  • Plugin system (pandoc-style JSON filters, lua filters) exists but runs on the position-less AST — it cannot recover source lines; the Swift-side chunker stamp is the mechanism.

[Generated by AI]

Part of #20 ## Question Pivot the reading renderer from hand-rolled TextKit to **apex → HTML → WKWebView + our CSS**? Edit mode stays TextKit (ADR-0010 mode B untouched); only the reading half is in play. Resolves: the pivot verdict itself, apex bundling strategy, fate of the TextKit reading renderer (+ the known stale-flow defect), the source-position mapping mechanism for click-to-edit/scroll-sync, and the execution-extension of this map (spike → verdict ADR → rebuild chain replacing the TextKit renderer work, with #72 remaining the terminal gate). Facts pinned 2026-10-06 (probed live, apex 1.1.17 via brew): - **License: MIT** — GPL-3.0-compatible, bundling/vendoring unproblematic. - **Latency:** kitchen-sink.md (1.4K) → 2.2KB HTML in **17 ms wall** including subprocess spawn; PERF-3k (21K) → 23.6KB in **19 ms**. Subprocess is a non-issue. - **Coverage:** nested lists, `1. 1. 1.` auto-renumbering, table alignment, quotes, fenced code all render correctly — #69's entire rendered scope plus footnotes/math/metadata we never hand-rolled. - **No source positions** in any output format (HTML, pandoc JSON AST, ast-json): click-to-edit and scroll-sync must use our blank-line chunker as a post-pass stamping `data-source-line` on top-level elements — paragraph-level granularity, matching #68's "caret at paragraph start" contract. - Plugin system (pandoc-style JSON filters, lua filters) exists but runs on the position-less AST — it cannot recover source lines; the Swift-side chunker stamp is the mechanism. [Generated by AI]
AlexKucera added the wayfinder:grilling label 2026-10-06 15:14:06 +02:00
AlexKucera added a new dependency 2026-10-06 15:14:10 +02:00
AlexKucera self-assigned this 2026-10-06 15:14:10 +02:00
Author
Owner

Resolution

The pivot lands. Reading renderer = apex → HTML → WKWebView + our CSS; editing side stays TextKit (ADR-0010 mode B). Ruled by Alexander 2026-10-06:

  1. Pivot: YES. ADR-0001's native-only rule governs the editing side; reading is presentation — WKWebView allowed. The ADR that governs reading rendering is ADR-0010, superseded for the reading half by the incoming ADR-0011.
  2. Preprocessor: Apex (MIT, unified dialect — footnotes/math/definition lists/metadata; renumbering + table alignment for free).
  3. Bundling: (a) bundle the prebuilt binary in app resources, signed + notarized. No CI source build, no user install gate — a renderer must not grow a gate. (User noted temptation toward (c) given the Hermes precedent; speed-of-reading won.)
  4. TextKit reading machinery: DELETE entirely. The stale-flow defect dies unfixed by design; fallbacks rot. Decoupling surfaces a new obligation: the editing side, now standing alone as a plain-text Markdown surface, must be up to par — its line-spacing defect is ticketed (#77).
  5. Map extension: YES — execution chain #74 (spike) → #75 (ADR-0011) → #76 (rebuild); #72 remains the terminal calibration gate, calibrating the HTML surface.

Probed facts (apex 1.1.17, live): MIT license; kitchen-sink 1.4K → 17 ms wall incl. spawn; PERF-3k 21K → 19 ms; no source positions in any output format (HTML/pandoc JSON/ast-json) — click-to-edit + scroll-sync map via our blank-line chunker stamping data-source-line post-pass, paragraph granularity, matching #68's "caret at paragraph start" contract. Apex plugins (pandoc-style filters) cannot recover positions the AST never carries.

Folded (no veto): typography slots + flow knobs become CSS custom properties injected at load, Settings pane unchanged; WKWebView specifics (baseURL, CSP, ⌘-click, first-paint) are spike-scope details.

[Generated by AI]

## Resolution The pivot lands. Reading renderer = **apex → HTML → WKWebView + our CSS**; editing side stays TextKit (ADR-0010 mode B). Ruled by Alexander 2026-10-06: 1. **Pivot: YES.** ADR-0001's native-only rule governs the *editing* side; reading is presentation — WKWebView allowed. The ADR that governs reading rendering is ADR-0010, superseded for the reading half by the incoming ADR-0011. 2. **Preprocessor: Apex** (MIT, unified dialect — footnotes/math/definition lists/metadata; renumbering + table alignment for free). 3. **Bundling: (a) bundle the prebuilt binary** in app resources, signed + notarized. No CI source build, no user install gate — a renderer must not grow a gate. (User noted temptation toward (c) given the Hermes precedent; speed-of-reading won.) 4. **TextKit reading machinery: DELETE entirely.** The stale-flow defect dies unfixed by design; fallbacks rot. Decoupling surfaces a new obligation: the editing side, now standing alone as a plain-text Markdown surface, must be up to par — its line-spacing defect is ticketed (#77). 5. **Map extension: YES** — execution chain #74 (spike) → #75 (ADR-0011) → #76 (rebuild); #72 remains the terminal calibration gate, calibrating the HTML surface. Probed facts (apex 1.1.17, live): MIT license; kitchen-sink 1.4K → 17 ms wall incl. spawn; PERF-3k 21K → 19 ms; no source positions in any output format (HTML/pandoc JSON/ast-json) — click-to-edit + scroll-sync map via our blank-line chunker stamping `data-source-line` post-pass, paragraph granularity, matching #68's "caret at paragraph start" contract. Apex plugins (pandoc-style filters) cannot recover positions the AST never carries. Folded (no veto): typography slots + flow knobs become CSS custom properties injected at load, Settings pane unchanged; WKWebView specifics (baseURL, CSP, ⌘-click, first-paint) are spike-scope details. [Generated by AI]
Sign in to join this conversation.