mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
id mapping
This commit is contained in:
parent
ecaec9b8cb
commit
e0eb38c4fb
@ -82,8 +82,7 @@ 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 on same-page links
|
// prepend all IDs inside popovers to prevent duplicates
|
||||||
if (thisUrl.pathname === targetUrl.pathname) {
|
|
||||||
html.querySelectorAll("[id]").forEach((el) => {
|
html.querySelectorAll("[id]").forEach((el) => {
|
||||||
const targetID = `popover-${el.id}`
|
const targetID = `popover-${el.id}`
|
||||||
const targetLink = hash.startsWith("#popover")
|
const targetLink = hash.startsWith("#popover")
|
||||||
@ -92,7 +91,6 @@ async function mouseEnterHandler(
|
|||||||
el.id = targetID
|
el.id = targetID
|
||||||
hash = targetLink
|
hash = targetLink
|
||||||
})
|
})
|
||||||
}
|
|
||||||
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