fix: /docs 404 on direct navigation and theme not switching on docs page#73
Closed
maskedsyntax wants to merge 2 commits intomainfrom
Closed
fix: /docs 404 on direct navigation and theme not switching on docs page#73maskedsyntax wants to merge 2 commits intomainfrom
maskedsyntax wants to merge 2 commits intomainfrom
Conversation
…cs page Add vercel.json with cleanUrls to fix 404 when navigating directly to /docs. The static adapter generates docs.html (flat file) and Vercel needs cleanUrls enabled to route /docs to that file without a trailing slash or .html extension. Move syntax highlighting CSS from the Svelte component to app.css as global styles. Svelte's scoping hash was being added to the light-mode .hl-* rules but not to the dark-mode :global() overrides, causing the dark-mode selectors to not match and leaving syntax colors unchanged when switching themes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Safari defers style recalculation when data-* attributes change on <html> unless color-scheme is also set explicitly. Add color-scheme to both the CSS theme blocks and the apply() function so Safari immediately invalidates and repaints all dependent styles on toggle. Also wrap localStorage access in try-catch — Safari throws in certain privacy modes, silently breaking theme persistence and the initial theme application.
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.
Summary
Two bug fixes for the docs page.
404 on direct navigation to /docs — The static adapter generates
docs.htmlas a flat file. Withoutvercel.json, Vercel doesn't know to map/docstodocs.html. AddingcleanUrls: truefixes this.Theme toggle not working on docs page — Svelte's scoped CSS was adding a hash to the light-mode
.hl-*rules (e.g..hl-arg.svelte-xxxx) but not to the dark-mode:global([data-theme="dark"]) .hl-argoverrides, so the dark-mode selectors never matched. Moving all syntax highlighting CSS toapp.cssas global styles fixes the mismatch entirely.