build(deps): update latest
All checks were successful
Lint / lint (push) Successful in 54s
Test / test (push) Successful in 33s

This commit is contained in:
2023-07-18 23:18:39 +02:00
parent a33c682974
commit b0c27b3c3e
4 changed files with 918 additions and 419 deletions

View File

@ -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 = {
}
}
}
})
}
})
}
}

View File

@ -3,7 +3,7 @@ const MarkdownIt = require('markdown-it')
/**
* Calls the provided function for each matching token.
*
* @param {Object} params RuleParams instance.
* @param {object} params RuleParams instance.
* @param {string} type Token type identifier.
* @param {Function} handler Callback function.
* @returns {void}
@ -19,12 +19,12 @@ const filterTokens = (params, type, handler) => {
/**
* Adds a generic error object via the onError callback.
*
* @param {Object} onError RuleOnError instance.
* @param {object} onError RuleOnError instance.
* @param {number} lineNumber Line number.
* @param {string} [detail] Error details.
* @param {string} [context] Error context.
* @param {number[]} [range] Column and length of error.
* @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
* @param {object} [fixInfo] RuleOnErrorFixInfo instance.
* @returns {void}
*/
const addError = (onError, lineNumber, detail, context, range, fixInfo) => {
@ -52,7 +52,6 @@ const convertHeadingToHTMLFragment = (inlineText) => {
inlineText
.toLowerCase()
// RegExp source with Ruby's \p{Word} expanded into its General Categories
// eslint-disable-next-line max-len
// https://github.com/gjtorikian/html-pipeline/blob/main/lib/html/pipeline/toc_filter.rb
// https://ruby-doc.org/core-3.0.2/Regexp.html
.replace(