Repository navigation
Search the manuals on the site itself (instead of Qwant), with ⌘K jump-to-page - #29
Open
tombouctou wants to merge 4 commits into
Open
tombouctou wants to merge 4 commits into
tombouctou wants to merge 4 commits into
Conversation
…o jump to a page The search box in the top bar sent the query to Qwant with "site:feyncalc.github.io". It now goes to a search page on the site itself (/search), which searches the FeynCalc manual (stable and development), the FeynHelpers manual and the example gallery entirely in the browser: no third-party service, nothing sent anywhere, works offline and on a local `jekyll serve`. The engine is sitesearch (https://github.com/tombouctou/sitesearch), attached as a git submodule over https so that GitHub Pages fetches it. - _pages/search.html: the search page. Pages whose name matches come first (nav-index.json is read first), then the paragraphs mentioning it. - _includes/head.html: palette.js on every page. ⌘K / Ctrl-K (or "/") opens a jump-to-page palette over the names of all manual pages and examples; a query no name matches falls through to the full text. Its button sits in the top bar next to the search box (#nav-jump). - tools/search-index.js: the manuals are pandoc HTML that Jekyll does not read, so their indexes are built by this script (Node, no dependencies) and committed: <book>/search-index.json + search-index-text/ (two-tier: a word map plus chunks of text fetched per query) and nav-index.json. Rerun it after regenerating the manuals. - _data/sitesearch.yml: the site's own Markdown pages are indexed by Jekyll (sitesearch/jekyll/search-index.json -> /search-index.json), which names the manuals' indexes as shards. - _config.yml: the submodule's docs and checks and tools/ are excluded from the site; the old forum archive stays out of the index. - css/hyde.css: the palette and the results in the site's colours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- sitesearch -> 387daa9: formulas are found however they are spelled
(γ^μγ^ν finds \bar{\gamma}^{\mu } \bar{\gamma}^{\nu }, \[Mu] is μ),
and queries with punctuation (Passarino-Veltman, DiracTrace[) now work
in two-tier indexes.
- tools/search-index.js keeps displayed formulas (the output cells), which
html.js now hands over as TeX. Only the displayed formulas over 1000
characters are dropped (232 of 12 181, a quarter of all the TeX): past
600 characters the engine shows a formula as cut TeX anyway, and no query
is answered only by a three-screen expression.
- /search: KaTeX (0.16.11 from jsDelivr, pinned with SRI) draws formulas in
the results — without it they are shown as TeX; symbols.js lets a reader
type \gam or pick from a Σ grid to enter a symbol.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ex.js) Generated; rerun the script after regenerating the manuals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…prompt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
The search box in the top bar currently sends the query to Qwant with
site:feyncalc.github.io. This PR replaces that with a search that runs entirely in the browser over the site's own index.What changes for a reader
/search?q=…. It searches the FeynCalc manual (stable and development), the FeynHelpers manual and the example gallery.Contract,DiracTraceorTIDlead straight to their manual pages. After them come the paragraphs that mention the term, each linking to its section anchor.γ^μγ^νfinds\bar{\gamma}^{\mu } \bar{\gamma}^{\nu },m_μ^2findsm_{\mu }^2in the examples' results, and Mathematica's\[Mu]is μ.\gamin the box, or clicking Σ, enters a symbol./) on any page opens a jump-to-page palette over the names of all manual pages and examples. TypeDiracTrand press Enter.jekyll serve, and offline./searchto draw formulas. Without it they are shown as TeX.How it works
The engine is sitesearch, a small dependency-free static-site search. It is attached as a git submodule over https, which GitHub Pages fetches itself; in a fresh clone run
git submodule update --init._pages/search.html: the search page._includes/head.html:palette.js(⌘K) on every page._includes/topbar.html: the Qwant form and its script are replaced by a form to/search, plus a slot for the ⌘K button.css/hyde.css: the palette and the results in the site's colours.tools/search-index.js: builds the index of the manuals.<book>/search-index.json,<book>/search-index-text/andnav-index.json.node tools/search-index.js(about 1 s) after regenerating the manuals or the examples, and commit the result._data/sitesearch.yml: the site's own Markdown pages are indexed by Jekyll itself (/search-index.json, built by the submodule's Liquid template), which names the manuals' indexes as shards._config.yml:tools/, are excluded from the site. Jekyll's defaultexcludelist is repeated, because listingexcludereplaces it.OldForumis excluded from the index withsearch: false.What is indexed, and the size
nav-index.json(⌘K, page names)nav-index.jsonis fetched in idle time on every page so that ⌘K is instant.descriptionstring, e.g. "El Ael -> Mu Amu, QED, total cross section, tree".Testing
bundle exec jekyll build, Ruby 3.3): no errors, 2.5 min.Contract,DiracTraceandTIDlist the named pages first (stable, then development manual), then the text hits.Passarino-Veltman,DiracTrace[,$FCDefaultanddimensional regularizationreturn the expected pages.γ^μγ^ν,m_μ^2and\gamma^5return results with the formulas drawn by KaTeX.DiracTr→ DiracTrace, DiracTraceEvaluate, DiracTrick;contract→ Contract first;QED renormalization→ the renormalization examples;Grozinfalls through to the text of the examples.Known limits
/reference*, ⌘K does not fire while focus is in the frame, because the manual pages are generated and carry no script. The top-bar button still works there.tools/search-index.js. Moving the site to a GitHub Pages Actions workflow could make that automatic, but it needs a change in the repository settings, so it is not part of this PR.Related
#28 fixes 76 manual/example pages where a code cell is shown as raw "```mathematica" text. If #28 is merged first, the indexes here should be rebuilt (
node tools/search-index.js) so that the search text matches the fixed pages. I can push that to this branch.🤖 Generated with Claude Code