mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2026-06-09 23:25:33 +02:00
build(deps): update latest
This commit is contained in:
+9
-7
@@ -16,26 +16,28 @@ const customRule = {
|
||||
tags: ['links'],
|
||||
function: (params, onError) => {
|
||||
filterTokens(params, 'inline', (token) => {
|
||||
token.children.forEach((child) => {
|
||||
for (const child of token.children) {
|
||||
const { lineNumber, type, attrs } = child
|
||||
|
||||
/** @type {string | null} */
|
||||
let hrefSrc = null
|
||||
|
||||
if (type === 'link_open') {
|
||||
attrs.forEach((attr) => {
|
||||
for (const attr of attrs) {
|
||||
if (attr[0] === 'href') {
|
||||
hrefSrc = attr[1]
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'image') {
|
||||
attrs.forEach((attr) => {
|
||||
for (const attr of attrs) {
|
||||
if (attr[0] === 'src') {
|
||||
hrefSrc = attr[1]
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (hrefSrc != null) {
|
||||
@@ -51,7 +53,7 @@ const customRule = {
|
||||
lineNumber,
|
||||
`${detail} should exist in the file system`
|
||||
)
|
||||
return
|
||||
continue
|
||||
}
|
||||
|
||||
if (type === 'link_open' && url.hash !== '') {
|
||||
@@ -81,7 +83,7 @@ const customRule = {
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user