Skip to content

Commit

Permalink
fix: don't show popovers on heading anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Dec 3, 2023
1 parent 0d8c025 commit 9c88d59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quartz/components/scripts/popover.inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down
5 changes: 5 additions & 0 deletions quartz/plugins/transformers/gfm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export const GitHubFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options> |
rehypeAutolinkHeadings,
{
behavior: "append",
properties: {
ariaHidden: true,
tabIndex: -1,
"data-no-popover": true,
},
content: {
type: "text",
value: " §",
Expand Down

0 comments on commit 9c88d59

Please sign in to comment.