Skip to content

fix: /docs 404 on direct navigation and theme not switching on docs page#73

Closed
maskedsyntax wants to merge 2 commits intomainfrom
docs/sync-feature-set
Closed

fix: /docs 404 on direct navigation and theme not switching on docs page#73
maskedsyntax wants to merge 2 commits intomainfrom
docs/sync-feature-set

Conversation

@maskedsyntax
Copy link
Member

Summary

Two bug fixes for the docs page.

404 on direct navigation to /docs — The static adapter generates docs.html as a flat file. Without vercel.json, Vercel doesn't know to map /docs to docs.html. Adding cleanUrls: true fixes 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-arg overrides, so the dark-mode selectors never matched. Moving all syntax highlighting CSS to app.css as global styles fixes the mismatch entirely.

…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.
@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hashprep Ready Ready Preview, Comment Mar 16, 2026 3:13pm

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant