From 4e23e6724493a8d112c6ff22e14cf4aabd5e9af1 Mon Sep 17 00:00:00 2001
From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com>
Date: Mon, 11 Sep 2023 06:11:42 +0000
Subject: [PATCH] feat: plugin for remark-breaks (#467)
---
quartz/components/scripts/graph.inline.ts | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/quartz/components/scripts/graph.inline.ts b/quartz/components/scripts/graph.inline.ts
index e589217..dc5c99d 100644
--- a/quartz/components/scripts/graph.inline.ts
+++ b/quartz/components/scripts/graph.inline.ts
@@ -47,11 +47,12 @@
const data = await fetchData
const links: LinkData[] = []
+ const validLinks = new Set(Object.keys(data).map((slug) => simplifySlug(slug as FullSlug)))
for (const [src, details] of Object.entries<ContentDetails>(data)) {
const source = simplifySlug(src as FullSlug)
const outgoing = details.links ?? []
for (const dest of outgoing) {
- if (dest in data) {
+ if (validLinks.has(dest)) {
links.push({ source, target: dest })
}
}
@@ -231,7 +232,9 @@
.attr("dy", (d) => -nodeRadius(d) + "px")
.attr("text-anchor", "middle")
.text(
- (d) => data[d.id]?.title || (d.id.charAt(1).toUpperCase() + d.id.slice(2)).replace("-", " "),
+ (d) =>
+ data[d.id]?.title ||
+ (d.id.charAt(0).toUpperCase() + d.id.slice(1, d.id.length - 1)).replace("-", " "),
)
.style("opacity", (opacityScale - 1) / 3.75)
.style("pointer-events", "none")
--
Gitblit v1.10.0