mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
fix(popover): automatically position heading links at heading
This commit is contained in:
parent
f334e78ed6
commit
578b2b3368
@ -82,8 +82,10 @@ async function mouseEnterHandler(
|
|||||||
const contents = await response.text()
|
const contents = await response.text()
|
||||||
const html = p.parseFromString(contents, "text/html")
|
const html = p.parseFromString(contents, "text/html")
|
||||||
normalizeRelativeURLs(html, targetUrl)
|
normalizeRelativeURLs(html, targetUrl)
|
||||||
// strip all IDs from elements to prevent duplicates
|
// strip all IDs from non-heading elements
|
||||||
html.querySelectorAll("[id]").forEach((el) => el.removeAttribute("id"))
|
html
|
||||||
|
.querySelectorAll("[id]:not(:is(h1, h2, h3, h4, h5, h6))")
|
||||||
|
.forEach((el) => el.removeAttribute("id"))
|
||||||
const elts = [...html.getElementsByClassName("popover-hint")]
|
const elts = [...html.getElementsByClassName("popover-hint")]
|
||||||
if (elts.length === 0) return
|
if (elts.length === 0) return
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user