Skip to content

Commit

Permalink
Addon-docs: URL encode anchor IDs when clicking in ToC
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidnioulz committed Dec 24, 2024
1 parent 2146472 commit c9d5743
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/lib/blocks/src/components/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const TableOfContents = ({
e.preventDefault();
if (e.currentTarget instanceof HTMLAnchorElement) {
const [, headerId] = e.currentTarget.href.split('#');
channel.emit(NAVIGATE_URL, `#${headerId}`);
channel.emit(NAVIGATE_URL, `#${encodeURIComponent(headerId)}`);
}
},
...unsafeTocbotOptions,
Expand Down

0 comments on commit c9d5743

Please sign in to comment.