Repository navigation
docs: clicking a heading's # link copies its URL - #1248
Merged
Merged
Conversation
Eject the theme's Heading so the hover # link, besides putting the hash in the address bar as before, writes the heading's full URL to the clipboard and shows "Link copied" beside the # for 1.5s. The link is kept visible on touch screens (no hover there) and while in the copied state, since clicking scrolls the heading out from under the cursor. The theme's own hash-link CSS comes along, as it is only loaded by the original component. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J3DrQy8Pdg8KsM31aMxJaM
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1248 +/- ##
=======================================
Coverage 47.57% 47.57%
=======================================
Files 81 81
Lines 9341 9341
=======================================
Hits 4444 4444
Misses 4897 4897 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Follow-up to #1247. The hover
#next to every heading on onctl.sh (homepage sections and docs pages alike) now copies the heading's full URL to the clipboard when clicked, and shows Link copied beside the#for 1.5 s. The default behaviour (hash goes in the address bar, page scrolls there) is unchanged.Implementation:
docs/src/theme/Heading/is an ejected copy of theme-classic'sHeadingwith the hash link swapped for one that also writes tonavigator.clipboard. Details:.hash-linkCSS is carried over, since only the original component loads it;#, not above it, since the heading lands just under the sticky navbar;hover: none) the#is always visible.Verified with headless Chrome against
npm run buildoutput: clipboard getshttp://host/#tuion the homepage andhttp://host/docs/getting-started#initializeon a docs page, the toast appears and is gone after 1.6 s, light and dark mode both fine.npm run typecheckandnpm run buildpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01J3DrQy8Pdg8KsM31aMxJaM