fix(web): in-app Help deep links resolve to the right section + heading#14
Merged
Conversation
The build-time docs transform collapsed 'file.md#heading' cross-doc links to just '#slug' (dropping the fragment) and rewrote the docs-index link (README.md) to a '#README' anchor with no matching section, so the in-app Help page silently fell back to Getting Started. marked also emitted headings with no id, so there was no scroll target even if the fragment survived. - build-docs.mjs: add GitHub-style slug ids to every heading; preserve a link's fragment as '#slug__heading'; map the README docs-index link to '#' (Help home). - help/+page.svelte: parse '#slug__heading', select the section, and scroll the target heading into view (guarded to a slug shape). GitHub rendering is unchanged (source .md files untouched). Rebuilt the SPA bundle. Found by the post-release audit.
12daad0 to
fd4df9b
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.
Fixes the two low/cosmetic in-app Help nav findings from the post-release audit. GitHub rendering is unchanged — the source
.mdfiles are untouched; only the build-time transform that mirrors docs into the app changed.Bug:
build-docs.mjsrewrote inter-doc links but (a) dropped the#fragmentfromfile.md#headinglinks → landed at the top of the target section, and (b) turnedREADME.md(the docs index, which the app doesn't render as a section) into#README, which matches nothing → silent fallback to Getting Started.markedalso emitted headings with noid, so fragments had no scroll target regardless.Fix:
build-docs.mjs— slugids on every heading (GitHub-style algorithm); preserve a link's fragment as#slug__heading; map the docs-index link to#(Help home).help/+page.svelte— parse#slug__heading, switch to that section and scroll the heading into view (guarded to a slug shape so a crafted hash can't break the query).Verified:
docsregen → README link#, Embeddings link#models__embeddings-for-knowledge-searchwith a matching<h… id="embeddings-for-knowledge-search">; plain cross-doc links still#slug; absolute/SECURITY links untouched; 57 headings now anchorable.npm run check0/0,npm test54, build OK; shipped bundle carries the fix. (docs.generated.tsis gitignored — regenerated by thewebCI job.)