From 8c027c2a7c443074fd0d4890f7736b444f9254aa Mon Sep 17 00:00:00 2001 From: Bojan Rajh <117360292+bojanrajh@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:33:35 +0200 Subject: [PATCH] feat: add source param to the deadlink check fn (#4870) --- src/node/markdownToVue.ts | 4 ++-- src/node/siteConfig.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/markdownToVue.ts b/src/node/markdownToVue.ts index 6d2ba98d..1278a333 100644 --- a/src/node/markdownToVue.ts +++ b/src/node/markdownToVue.ts @@ -189,13 +189,13 @@ export async function createMarkdownToVueRenderFn( return ignore.test(url) } if (typeof ignore === 'function') { - return ignore(url) + return ignore(url, fileOrig) } return false }) } - if (links) { + if (links && siteConfig?.ignoreDeadLinks !== true) { const dir = path.dirname(file) for (let url of links) { const { pathname } = new URL(url, 'http://a.com') diff --git a/src/node/siteConfig.ts b/src/node/siteConfig.ts index 82ab3162..99751d5e 100644 --- a/src/node/siteConfig.ts +++ b/src/node/siteConfig.ts @@ -114,7 +114,7 @@ export interface UserConfig ignoreDeadLinks?: | boolean | 'localhostLinks' - | (string | RegExp | ((link: string) => boolean))[] + | (string | RegExp | ((link: string, source: string) => boolean))[] /** * Don't force `.html` on URLs.