feat: add source param to the deadlink check fn (#4870)

pull/4873/head
Bojan Rajh 1 month ago committed by GitHub
parent 45e0d0f62a
commit 8c027c2a7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -189,13 +189,13 @@ export async function createMarkdownToVueRenderFn(
return ignore.test(url) return ignore.test(url)
} }
if (typeof ignore === 'function') { if (typeof ignore === 'function') {
return ignore(url) return ignore(url, fileOrig)
} }
return false return false
}) })
} }
if (links) { if (links && siteConfig?.ignoreDeadLinks !== true) {
const dir = path.dirname(file) const dir = path.dirname(file)
for (let url of links) { for (let url of links) {
const { pathname } = new URL(url, 'http://a.com') const { pathname } = new URL(url, 'http://a.com')

@ -114,7 +114,7 @@ export interface UserConfig<ThemeConfig = any>
ignoreDeadLinks?: ignoreDeadLinks?:
| boolean | boolean
| 'localhostLinks' | 'localhostLinks'
| (string | RegExp | ((link: string) => boolean))[] | (string | RegExp | ((link: string, source: string) => boolean))[]
/** /**
* Don't force `.html` on URLs. * Don't force `.html` on URLs.

Loading…
Cancel
Save