From 9c88d5967fee49d9e69b0e5dd22ca3bc44f9a12e Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 3 Dec 2023 09:22:16 -0800 Subject: [PATCH] fix: don't show popovers on heading anchors --- quartz/components/scripts/popover.inline.ts | 4 ++++ quartz/plugins/transformers/gfm.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts index 08668ae8..4d51e2a6 100644 --- a/quartz/components/scripts/popover.inline.ts +++ b/quartz/components/scripts/popover.inline.ts @@ -7,6 +7,10 @@ async function mouseEnterHandler( { clientX, clientY }: { clientX: number; clientY: number }, ) { const link = this + if (link.dataset.noPopover === "true") { + return + } + async function setPosition(popoverElement: HTMLElement) { const { x, y } = await computePosition(link, popoverElement, { middleware: [inline({ x: clientX, y: clientY }), shift(), flip()], diff --git a/quartz/plugins/transformers/gfm.ts b/quartz/plugins/transformers/gfm.ts index 62624aac..40c2205d 100644 --- a/quartz/plugins/transformers/gfm.ts +++ b/quartz/plugins/transformers/gfm.ts @@ -31,6 +31,11 @@ export const GitHubFlavoredMarkdown: QuartzTransformerPlugin | rehypeAutolinkHeadings, { behavior: "append", + properties: { + ariaHidden: true, + tabIndex: -1, + "data-no-popover": true, + }, content: { type: "text", value: " ยง",