From 4d5344dc64feca4c14264dca8aa7b62590eab69c Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 22 Dec 2021 04:26:06 +0100 Subject: [PATCH] Fix for broken graph edges when note links to anchor (#45) --- src/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index edcfecd..45ab0e0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,14 @@ async function fetchData() { notes.forEach(function(note, id) { var links = note["links"] - for (const link of links) { + for (let link of links) { + + // Slice note link if link directs to an anchor + var index = link.indexOf("#"); + if(index != -1){ + link = link.substr(0,index); + } + var linkDestExists = notes.has(link); if (linkDestExists) { data.edges.push({