diff --git a/assets/js/popover.js b/assets/js/popover.js index 6fec7e5e0..c7b116500 100644 --- a/assets/js/popover.js +++ b/assets/js/popover.js @@ -24,9 +24,16 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) { } else { const linkDest = content[li.dataset.src.replace(/\/$/g, "").replace(basePath, "")] if (linkDest) { + let splitLink = li.href.split("#") + let cleanedContent = removeMarkdown(linkDest.content) + if (splitLink.length > 1) { + let headingName = splitLink[1].replace(/\-/g, " ") + let headingIndex = cleanedContent.toLowerCase().indexOf("" + headingName + "") + cleanedContent = cleanedContent.substring(headingIndex, cleanedContent.length) + } const popoverElement = `
${removeMarkdown(linkDest.content).split(" ", 20).join(" ")}...
+${cleanedContent.split(" ", 20).join(" ")}...