From 12eb361d69130287de80c20bc8442ab7f3b82a8d Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 12 Feb 2023 20:13:59 +0100 Subject: [PATCH] remove slash before anchor link --- website/src/components/RightSidebar/TableOfContents.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/src/components/RightSidebar/TableOfContents.tsx b/website/src/components/RightSidebar/TableOfContents.tsx index 99c0eb54..d5843043 100644 --- a/website/src/components/RightSidebar/TableOfContents.tsx +++ b/website/src/components/RightSidebar/TableOfContents.tsx @@ -12,6 +12,8 @@ const TableOfContents: FunctionalComponent<{ headings: MarkdownHeading[]; curren headings = [], currentPage, }) => { + // remove slash before # + currentPage = currentPage.endsWith('/') ? currentPage.slice(0, -1) : currentPage; const toc = useRef(); const onThisPageID = 'on-this-page-heading'; const itemOffsets = useRef([]);