mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2026-06-09 23:25:33 +02:00
fix: ignore external https image links
This commit is contained in:
+15
-2
@@ -70,11 +70,24 @@ const relativeLinksRule = {
|
||||
url = new URL(hrefSrc, pathToFileURL(params.name))
|
||||
}
|
||||
|
||||
if (url.protocol !== "file:" && type !== "image") {
|
||||
const detail = `"${hrefSrc}"`
|
||||
|
||||
if (
|
||||
type === "image" &&
|
||||
url.protocol !== "file:" &&
|
||||
url.protocol !== "http:" &&
|
||||
url.protocol !== "https:"
|
||||
) {
|
||||
onError({
|
||||
lineNumber,
|
||||
detail: `${detail} should be an image`,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
const detail = `"${hrefSrc}"`
|
||||
if (url.protocol !== "file:") {
|
||||
continue
|
||||
}
|
||||
|
||||
if (!fs.existsSync(url)) {
|
||||
onError({
|
||||
|
||||
Reference in New Issue
Block a user