Repository navigation
feat: share the theme build flow in @wazoo/wiki/theme - #412
Merged
Merged
Conversation
docs/build.ts and the wikipedia template each carried a copy of the page loop, the token table, and the shell builders. buildThemedSite moves that flow into @wazoo/wiki/theme so a theme supplies only its layouts, tokens, and highlighter (#409). docs/build.ts drops from 791 to 93 lines of policy. The docs site output is byte-identical: 114 files, every SHA256 unchanged.
This was referenced Oct 14, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
@wazoo/wiki/themeentrypoint now exports a whole-site driver for a custom theme,buildThemedSite, so a theme no longer reimplements the page loop. This is the engine half of #409; thewiki-templateswikipedia theme consumes it in the follow-on change (blocked on publishing this).Before this,
docs/build.ts(791 lines) andtemplates/wikipedia/build.ts(797 lines) differed by ~113 lines — the page loop, the token table, the infobox/categories/backlinks/TOC builders, and the metadata-panel emission were duplicated.What moved
src/wiki/site/theme_build.ts(new) owns page walking, the page shell (TOC, infobox, backlinks, categories, metadata panels),%wiki.*%substitution, output writing, and asset copying.title_suffix,tokens(extra or overriding%wiki.*%values), andmetadata(views,selected_view,note,highlight).docs/build.tsdrops from 791 to 93 lines and is now policy only: the two layouts, the- Wikititle suffix, and the two tokens that need a GitHub remote (edit link, redirect URL).escapeHtml,safeJson, andsubstituteare exported so a theme can compose its own token values; the shell slot list is documented.Decisions recorded once, in the shared contract
xmlmetadata view is excluded by default. The reason (RDF/XML output is deferred while input is supported) is stated in the module doc, so themes stop rediscovering it.metadata.viewsre-enables it.metadata.highlightreturns HTML (escape the text yourself when the grammar highlights nothing); the default escapes the whole body. This is what lets the docs theme escape and the wikipedia theme highlight with Prism through one code path.renderLayoutstill fills only three slots;buildThemedSitefills the full shell of nineteen. Both are documented as such.Verification
Output-neutral by construction, and proven:
maininto a baseline tree, then again after the refactor: 114 files, every SHA256 identical (Built 111 pages).deno check src/wiki tests docs/build.ts→ exit 0deno run -A src/wiki/cli.ts -c docs/wiki.yml fmt --check | lint --strict | check --strict | render --check→ all exit 0deno task fmt:check/deno task lint/deno task check→ exit 0deno task test→ 569 passed, 1 ignored, 5 failed. The 5 aretests/verify_cli_test.ts(retired-Python-CLI-on-PATH and cutover-version cases); they fail identically on pristinemainin this environment. The count is 569 rather than the previous 568 because this PR adds one test.buildThemedSite owns the flow while the theme owns the vocabularycovers a minimal theme: custom layout,title_suffix, atokenstable, ahighlightoverride, aredirect_layout, index filtering, asset copying, the xml-view default, and the verbatim-unfilled-token rule.What I could not verify
wiki-templateswikipedia theme's build against this surface. It pins the published package, so it cannot consumebuildThemedSiteuntil this is released; that refactor and its output comparison are the follow-on change (T5b), perAGENTS.md("Bump pinned versions only after publishing").