From c35cd422c65a58f1069302aad0cf9eef7f93d987 Mon Sep 17 00:00:00 2001
From: Ben Schlegel <31989404+benschlegel@users.noreply.github.com>
Date: Mon, 28 Aug 2023 17:00:49 +0000
Subject: [PATCH] fix: correct graph labels for `index.md` nodes (#431)

---
 quartz/plugins/transformers/links.ts |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/quartz/plugins/transformers/links.ts b/quartz/plugins/transformers/links.ts
index d9c9c7c..26c4a32 100644
--- a/quartz/plugins/transformers/links.ts
+++ b/quartz/plugins/transformers/links.ts
@@ -60,10 +60,17 @@
                     dest,
                     transformOptions,
                   )
+
+                  // url.resolve is considered legacy
+                  // WHATWG equivalent https://nodejs.dev/en/api/v18/url/#urlresolvefrom-to
                   const url = new URL(dest, `https://base.com/${curSlug}`)
                   const canonicalDest = url.pathname
                   const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
-                  const simple = simplifySlug(destCanonical as FullSlug)
+
+                  // need to decodeURIComponent here as WHATWG URL percent-encodes everything
+                  const simple = decodeURIComponent(
+                    simplifySlug(destCanonical as FullSlug),
+                  ) as SimpleSlug
                   outgoing.add(simple)
                 }
 

--
Gitblit v1.10.0