diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts index 733779369..1487b1fb7 100644 --- a/quartz/components/scripts/popover.inline.ts +++ b/quartz/components/scripts/popover.inline.ts @@ -82,8 +82,10 @@ async function mouseEnterHandler( const contents = await response.text() const html = p.parseFromString(contents, "text/html") normalizeRelativeURLs(html, targetUrl) - // strip all IDs from elements to prevent duplicates - html.querySelectorAll("[id]").forEach((el) => el.removeAttribute("id")) + // strip all IDs from non-heading elements + html + .querySelectorAll("[id]:not(:is(h1, h2, h3, h4, h5, h6))") + .forEach((el) => el.removeAttribute("id")) const elts = [...html.getElementsByClassName("popover-hint")] if (elts.length === 0) return