mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-24 05:36:34 +00:00
fix inline link highlighting, safer latex render
This commit is contained in:
parent
e302f6c423
commit
ed9a8efd1f
3 changed files with 22 additions and 21 deletions
assets/js
|
@ -23,7 +23,6 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
|||
el = htmlToElement(popoverElement)
|
||||
} else {
|
||||
const linkDest = content[li.dataset.src.replace(/\/$/g, "").replace(basePath, "")]
|
||||
console.log(linkDest.content)
|
||||
if (linkDest) {
|
||||
const popoverElement = `<div class="popover">
|
||||
<h3>${linkDest.title}</h3>
|
||||
|
@ -33,25 +32,27 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
|||
el = htmlToElement(popoverElement)
|
||||
}
|
||||
}
|
||||
li.appendChild(el)
|
||||
if (renderLatex) {
|
||||
renderMathInElement(el, {
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: false },
|
||||
{ left: '$', right: '$', display: false },
|
||||
{ left: '\\(', right: '\\)', display: false },
|
||||
{ left: '\\[', right: '\\]', display: false }
|
||||
],
|
||||
throwOnError: false
|
||||
|
||||
if (el) {
|
||||
li.appendChild(el)
|
||||
if (renderLatex) {
|
||||
renderMathInElement(el, {
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: false },
|
||||
{ left: '$', right: '$', display: false },
|
||||
{ left: '\\(', right: '\\)', display: false },
|
||||
{ left: '\\[', right: '\\]', display: false }
|
||||
],
|
||||
throwOnError: false
|
||||
})
|
||||
}
|
||||
li.addEventListener("mouseover", () => {
|
||||
el.classList.add("visible")
|
||||
})
|
||||
li.addEventListener("mouseout", () => {
|
||||
el.classList.remove("visible")
|
||||
})
|
||||
}
|
||||
li.addEventListener("mouseover", () => {
|
||||
el.classList.add("visible")
|
||||
})
|
||||
li.addEventListener("mouseout", () => {
|
||||
el.classList.remove("visible")
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue