Skip to content

Commit

Permalink
Merge pull request #25062 from xyy94813/feature/subheading-tag-id
Browse files Browse the repository at this point in the history
refactor: use encodeURIComponent to encode story name
  • Loading branch information
valentinpalkovic authored Dec 7, 2023
2 parents f885ece + 1ed3441 commit 7c32fb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/ui/blocks/src/blocks/Subheading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Subheading: FC<PropsWithChildren<HeadingProps>> = ({ children, disa
if (disableAnchor || typeof children !== 'string') {
return <H3>{children}</H3>;
}
const tagID = children.toLowerCase().replace(/[^a-z0-9]/gi, '-');
const tagID = globalThis.encodeURIComponent(children.toLowerCase());
return (
<HeaderMdx as="h3" id={tagID}>
{children}
Expand Down

0 comments on commit 7c32fb5

Please sign in to comment.