Add anchor links and hash navigation to plugin gallery#14
Merged
Conversation
- Each plugin card now has an id matching its plugin name - Plugin titles are clickable anchor links (#pluginname) - Opening the page with #pluginname expands that plugin and scrolls to it - If no exact plugin match, the hash is used as a search query - Typing in search updates the URL hash in real-time - Expanding a plugin updates the URL hash to its name https://claude.ai/code/session_013iGTroMjCqyeRLMAkwXJ1z
The <details id="..."> element itself is the anchor target, so no visible <a> tag is needed around the title. https://claude.ai/code/session_013iGTroMjCqyeRLMAkwXJ1z
Contributor
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/index.html.j2">
<violation number="1" location="docs/index.html.j2:1315">
P2: Encode the hash value before calling replaceState; otherwise a search query with `%` (or other reserved characters) produces an invalid fragment and `decodeURIComponent` throws, stopping hash navigation.</violation>
</file>
<file name="docs/index.html">
<violation number="1" location="docs/index.html:9692">
P2: Guard decodeURIComponent against malformed hash values; an invalid percent-encoded fragment will throw and break hash navigation.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Comment on lines
+1315
to
+1317
| const clean = value.replace(/^#/, "").trim(); | ||
| if (clean) { | ||
| history.replaceState(null, "", "#" + clean); |
Contributor
There was a problem hiding this comment.
P2: Encode the hash value before calling replaceState; otherwise a search query with % (or other reserved characters) produces an invalid fragment and decodeURIComponent throws, stopping hash navigation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/index.html.j2, line 1315:
<comment>Encode the hash value before calling replaceState; otherwise a search query with `%` (or other reserved characters) produces an invalid fragment and `decodeURIComponent` throws, stopping hash navigation.</comment>
<file context>
@@ -1299,17 +1311,54 @@
- searchInput.addEventListener("input", applyFilter);
+ const setHash = (value) => {
+ const clean = value.replace(/^#/, "").trim();
+ if (clean) {
+ history.replaceState(null, "", "#" + clean);
</file context>
Suggested change
| const clean = value.replace(/^#/, "").trim(); | |
| if (clean) { | |
| history.replaceState(null, "", "#" + clean); | |
| const clean = value.replace(/^#/, "").trim(); | |
| const encoded = encodeURIComponent(clean); | |
| if (encoded) { | |
| history.replaceState(null, "", "#" + encoded); |
| }; | ||
|
|
||
| const navigateToHash = () => { | ||
| const hash = decodeURIComponent(location.hash.replace(/^#/, "")).trim(); |
Contributor
There was a problem hiding this comment.
P2: Guard decodeURIComponent against malformed hash values; an invalid percent-encoded fragment will throw and break hash navigation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/index.html, line 9692:
<comment>Guard decodeURIComponent against malformed hash values; an invalid percent-encoded fragment will throw and break hash navigation.</comment>
<file context>
@@ -9610,17 +9679,54 @@ <h3>Community and social</h3>
+ };
+
+ const navigateToHash = () => {
+ const hash = decodeURIComponent(location.hash.replace(/^#/, "")).trim();
+ if (!hash) return;
+
</file context>
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
This PR adds anchor link support to the plugin gallery, allowing users to link directly to specific plugins and navigate to them via URL hash fragments.
Key Changes
.plugin-anchorCSS class with hover underline effect for plugin title linksidattribute to each plugin card using the plugin's slug name (e.g.,id="ytdlp")Implementation Details
setHash()function manages URL history updates without full page reloadsnavigateToHash()function handles both direct plugin navigation (opens the card) and search-based navigation (filters gallery)hashchangeevent listener for browser navigation supporttoggleevents to update the hash when manually opened/closedhttps://claude.ai/code/session_013iGTroMjCqyeRLMAkwXJ1z
Summary by cubic
Add deep links and hash navigation to the plugin gallery. You can link to a specific plugin or share a search, with smooth scroll and back/forward support.
ytdlp).#<name>opens and scrolls to the card; otherwise the hash becomes the search query.history.replaceStateandhashchangefor smooth navigation without reloads.Written for commit 4fcecf7. Summary will update on new commits.