From 41c443dbf079e65ed69f57d3b9a5ce58dc403e6d Mon Sep 17 00:00:00 2001
From: earnest ma <me@earne.link>
Date: Fri, 11 Feb 2022 22:15:28 +0000
Subject: [PATCH] Add disableToc parameter to not show TOC on a page

---
 layouts/partials/popover.html |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/layouts/partials/popover.html b/layouts/partials/popover.html
index afcf4c5..3a7de11 100644
--- a/layouts/partials/popover.html
+++ b/layouts/partials/popover.html
@@ -7,10 +7,12 @@
     return template.content.firstChild
   }
 
+  const pathRegex = /\.\.?(\/\.\.)*/
   document.addEventListener("DOMContentLoaded", () => {
     [...document.getElementsByClassName("internal-link")]
       .forEach(li => {
-        const linkDest = content[li.dataset.src]
+        console.log(li.dataset.src.replace(pathRegex, ''))
+        const linkDest = content[li.dataset.src.replace(pathRegex, '')]
         if (linkDest) {
           const popoverElement = `<div class="popover">
     <h3>${linkDest.title}</h3>

--
Gitblit v1.10.0