Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
Fix Notion TOC scrolling by obfuscating anchor hrefs
Cursor Agent97ad7b4cd10b
diff --git a/components/view/viewer/notion-page.tsx b/components/view/viewer/notion-page.tsxindex 127b61c3..d3775725 100644--- a/components/view/viewer/notion-page.tsx+++ b/components/view/viewer/notion-page.tsx@@ -103,6 +103,24 @@ const obfuscateNotionIds = (container: HTMLElement) => {}uuidPattern.lastIndex = 0;});++ // Obfuscate anchor href attributes that contain hash references to Notion IDs+ // This is important for table of contents links to work after ID obfuscation+ const anchorsWithHash = container.querySelectorAll('a[href^="#"]');+ anchorsWithHash.forEach((anchor) => {+ const href = anchor.getAttribute("href");+ if (href) {+ // Extract the hash part (remove the leading #)+ const hashId = href.slice(1);+ if (uuidPattern.test(hashId)) {+ const newHashId = hashId.replace(uuidPattern, (match) =>+ getObfuscatedId(match),+ );+ anchor.setAttribute("href", `#${newHashId}`);+ }+ uuidPattern.lastIndex = 0;+ }+ });};export const NotionPage = ({