feat(site): search the explainer and the docs (phase 6) - #69
Merged
Merged
Conversation
This was referenced Sep 23, 2026
Merged
A search dialog, from the header button or with / or Ctrl+K, over every section of the explainer and the docs. Results show page and heading with a marked snippet; arrow keys move, Enter opens, Esc closes and returns focus. build_site.py writes search-index.json from the renderer's per-section text (and the explainer's sections), and the browser fetches it from the site only when search first opens. site/search.js ranks without a library: every term must match the start of a word, case and accents ignored, headings count more than body text, and body matches are capped so a long section cannot win on length. scripts/check_search.mjs holds the ranking to cases that say what a reader should find first, and, given the built site, every index entry to a page and id that exist and the files the page scripts fetch to be present (check_site_links.mjs only follows tags). site.yml runs it. The renderer now keeps a space for a line break inside a paragraph, so section text reads as prose rather than running words together. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
TMHSDigital
force-pushed
the
site/phase-6-search
branch
from
September 23, 2026 15:01
836ea57 to
f4d21ca
Compare
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.
Stacked on #68: its base is
site/phase-5-shell, so the diff shows only this phase. It retargets tomainwhen #68 merges.The site has eight docs and a long explainer, but the only way to find something was the browser's find-in-page on one page at a time. This adds site-wide search with no library and no third-party request.
What a reader gets
/orCtrl+K.How it works
build_site.pywritessearch-index.json: one entry per section of every doc and of the explainer, 90 entries and about 106 KB.site/search.jsdoes the ranking with pure functions, UMD likefloor.js:site.js, so a reader without scripts never sees a dead control.textContentand<mark>nodes, neverinnerHTML.CI
scripts/check_search.mjsis standard-library Node, andsite.ymlnow runs it. It checks:check_site_links.mjsonly follows HTML tags, so it cannot see these. This covers part of CI checks do not cover everything that ships #54.Checked
ruff,mypy --strict, andpytestpass. Three new tests cover the index: its shape and order, refusing an explainer it cannot read, and the per-entry length cap.render_docs --self-testpasses 21 cases.check_search.mjsandcheck_site_links.mjspass on the built site./andCtrl+Kopen search, Enter follows the top result, Esc closes and focus returns to the button that opened it. The phone width fits, and the console shows no errors.Found while testing: a link to
/#plannerstops short of the planner, because the worked example renders after load and pushes it down. That happens on the live site today. Phase 7 fixes it, since it rewrites that script.🤖 Generated with Claude Code