Fixed regex to not remove hashes on links beyond the initial one

This commit is contained in:
Piotr Janosz
2019-08-27 18:46:34 +02:00
parent 01a5472318
commit ac2443690c

View File

@@ -9,7 +9,7 @@ interface IInlineLinkProps {
}
export const InlineLink: React.FC<IInlineLinkProps> = ({ children, href }) => {
const to = href.replace(/#/, ''); // Remove hash from internal links so that react-scroll can find the target
const to = href.replace(/^#/, ''); // Remove initial hash from internal links so that react-scroll can find the target
return (
<Link containerId="" offset={-docs.headerOffset} shouldOpenInNewTab={true} to={to} textDecoration="underline">