Render org READMEs natively instead of in a web view !3

merged merged by cmc on 2026-08-31 19:11 UTC · krz/hutch:org-native-rendering into main

Discussion

cmc

Brings hutch to the same native org rendering gitbay-ios now uses.

RenderedMarkupContentView's org branch renders with OrgSwiftUI.OrgView instead of building HTML for a WKWebView. Selectable text, Dynamic Type and VoiceOver. Markdown is untouched and still renders through HTML — only the org path changes.

SyntaxHighlighter gains an OrgCodeStyler conformance beside its existing CodeHighlighter one. Highlightr already returns an NSAttributedString, so the native path skips the round-trip through color-styled <span>s, and the code font scales with Dynamic Type where the HTML was fixed at 12pt.

Behavior preserved

Links to files in this repository still open in-app. The web view intercepted its own navigation via onInterceptURL; the native path wraps OrgView in an OpenURLAction over the same hook, so parseLinkedFileRequest is reached exactly as before.

Relative links and images resolve through the same OrgRenderOptions the HTML renderer used, including repositoryHost.

Cleanup

org leaves RenderedReadmeHTMLCache, and its cache key drops the theme segment — that existed because highlight colors were baked into the cached string, which no longer happens.

Dependency

org-swift moves from branch: main to the 0.3.0 tag. Worth flagging: the revision pinned before (47ac630) no longer exists. main was rewritten, which orphaned it, so this project would have stopped resolving once that object was collected. Xcode's cached clone needs clearing if resolution fails.

Verification

Builds clean; the full HutchTests suite passes. OrgNativeRenderingTests covers the new styler conformance — highlighted output is multi-colored and monospaced, and an unknown language falls back rather than mis-highlighting.

I could not exercise the signed-in UI: hutch needs a sourcehut PAT, which I won't enter. The renderer itself is the same 0.3.0 that was verified on device against krz/gitbay's README in both appearances, so the unverified surface here is hutch's wiring — chiefly the OpenURLAction interception, which is worth a manual tap on a repo-relative link in an org README.

cmc 2026-08-31 19:11 UTC

Rebased onto the rewritten main (a8f630e) and force-pushed — the branch was rooted on the orphaned 3b72f57 and had no common ancestor, so the diff would not resolve.

Only the base moved; the five changed files are byte-identical to what was reviewed before. Builds clean against the new base. Anyone holding the old branch should reset rather than merge.