diff --git a/quartz/plugins/emitters/contentPage.tsx b/quartz/plugins/emitters/contentPage.tsx index dfac4a7ec..e0b3f6728 100644 --- a/quartz/plugins/emitters/contentPage.tsx +++ b/quartz/plugins/emitters/contentPage.tsx @@ -28,25 +28,17 @@ async function processContent( ) { const slug = fileData.slug! const cfg = ctx.cfg.configuration - - /** Until the end of visit(), this code snippet is from - * https://github.com/jackyzha0/quartz/issues/454#issuecomment-2408792538 - * by auctumnus - * - * It removes all the links that would lead to missing pages, ie. - * - * [[Missing link]] when Missing link.md does not exist. - */ + const allSlugs = allFiles.map((f) => (f.slug ? resolveRelative(slug, f.slug) : "")) - + visit(tree as Root, "element", (elem) => { if (elem.tagName === "a" && elem.properties.href) { const href = elem.properties.href.toString() - + if (href.startsWith("#")) { return } - + if (!allSlugs.includes(href as RelativeURL)) { if (elem.properties.className === undefined) { elem.properties.className = "dead-link" diff --git a/quartz/styles/custom.scss b/quartz/styles/custom.scss index f408788b7..752b145f4 100644 --- a/quartz/styles/custom.scss +++ b/quartz/styles/custom.scss @@ -12,4 +12,4 @@ border-radius: 5px; line-height: 1.4rem; cursor: default; -} \ No newline at end of file +}