From 6c19ce4b762e9c0c7c72fc0105b85aaaad5beafe Mon Sep 17 00:00:00 2001
From: "Thomas F. K. Jorna" <hello@tefkah.com>
Date: Sat, 4 Dec 2021 13:29:00 +0100
Subject: fix: solve unresolved statistics cookie hierarchy (#158)

---
 pages/index.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'pages/index.tsx')

diff --git a/pages/index.tsx b/pages/index.tsx
index 5900b9b..c74f0af 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -160,6 +160,8 @@ export function GraphPage() {
       }
     }, {})
 
+    // generate links between level 2 nodes and the level 1 node above it
+    // org-roam does not generate such links, so we have to put them in ourselves
     const headingLinks: OrgRoamLink[] = Object.keys(nodesByFile).flatMap((file) => {
       const nodesInFile = nodesByFile[file] ?? []
       // "file node" as opposed to "heading node"
@@ -174,8 +176,7 @@ export function GraphPage() {
           if (
             node.level >= headingNode.level ||
             node.pos >= headingNode.pos ||
-            !headingNode.olp?.includes(node.title) //||
-            //  node.level >= headingNode.level - headingNode.olp.reverse().indexOf(node.title)
+            !headingNode.olp?.includes((node.title as string)?.replace(/ *\[\d*\/\d*\] */g, ''))
           ) {
             return false
           }
-- 
cgit v1.2.3

