mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2024-12-08 00:45:32 +01:00
build(deps): update latest
This commit is contained in:
parent
a33c682974
commit
b0c27b3c3e
1290
package-lock.json
generated
1290
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@ -33,7 +33,7 @@
|
|||||||
"lint:commit": "commitlint",
|
"lint:commit": "commitlint",
|
||||||
"lint:editorconfig": "editorconfig-checker",
|
"lint:editorconfig": "editorconfig-checker",
|
||||||
"lint:markdown": "markdownlint-cli2",
|
"lint:markdown": "markdownlint-cli2",
|
||||||
"lint:eslint": "eslint . --ignore-path .gitignore",
|
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives --ignore-path .gitignore",
|
||||||
"lint:prettier": "prettier . --check --ignore-path .gitignore",
|
"lint:prettier": "prettier . --check --ignore-path .gitignore",
|
||||||
"lint:staged": "lint-staged",
|
"lint:staged": "lint-staged",
|
||||||
"test": "node --test ./test",
|
"test": "node --test ./test",
|
||||||
@ -46,23 +46,23 @@
|
|||||||
"markdown-it": "13.0.1"
|
"markdown-it": "13.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "17.6.5",
|
"@commitlint/cli": "17.6.6",
|
||||||
"@commitlint/config-conventional": "17.6.5",
|
"@commitlint/config-conventional": "17.6.6",
|
||||||
"@types/node": "20.3.1",
|
"@types/node": "20.4.2",
|
||||||
"editorconfig-checker": "5.0.1",
|
"editorconfig-checker": "5.1.1",
|
||||||
"eslint": "8.43.0",
|
"eslint": "8.45.0",
|
||||||
"eslint-config-conventions": "9.0.0",
|
"eslint-config-conventions": "11.0.1",
|
||||||
"eslint-config-prettier": "8.8.0",
|
"eslint-config-prettier": "8.8.0",
|
||||||
"eslint-plugin-import": "2.27.5",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"eslint-plugin-prettier": "4.2.1",
|
"eslint-plugin-prettier": "5.0.0",
|
||||||
"eslint-plugin-promise": "6.1.1",
|
"eslint-plugin-promise": "6.1.1",
|
||||||
"eslint-plugin-unicorn": "47.0.0",
|
"eslint-plugin-unicorn": "48.0.0",
|
||||||
"husky": "8.0.3",
|
"husky": "8.0.3",
|
||||||
"lint-staged": "13.2.2",
|
"lint-staged": "13.2.3",
|
||||||
"markdownlint": "0.29.0",
|
"markdownlint": "0.29.0",
|
||||||
"markdownlint-cli2": "0.8.1",
|
"markdownlint-cli2": "0.8.1",
|
||||||
"pinst": "3.0.0",
|
"pinst": "3.0.0",
|
||||||
"prettier": "2.8.8",
|
"prettier": "3.0.0",
|
||||||
"semantic-release": "21.0.5"
|
"semantic-release": "21.0.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
src/index.js
16
src/index.js
@ -16,26 +16,28 @@ const customRule = {
|
|||||||
tags: ['links'],
|
tags: ['links'],
|
||||||
function: (params, onError) => {
|
function: (params, onError) => {
|
||||||
filterTokens(params, 'inline', (token) => {
|
filterTokens(params, 'inline', (token) => {
|
||||||
token.children.forEach((child) => {
|
for (const child of token.children) {
|
||||||
const { lineNumber, type, attrs } = child
|
const { lineNumber, type, attrs } = child
|
||||||
|
|
||||||
/** @type {string | null} */
|
/** @type {string | null} */
|
||||||
let hrefSrc = null
|
let hrefSrc = null
|
||||||
|
|
||||||
if (type === 'link_open') {
|
if (type === 'link_open') {
|
||||||
attrs.forEach((attr) => {
|
for (const attr of attrs) {
|
||||||
if (attr[0] === 'href') {
|
if (attr[0] === 'href') {
|
||||||
hrefSrc = attr[1]
|
hrefSrc = attr[1]
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'image') {
|
if (type === 'image') {
|
||||||
attrs.forEach((attr) => {
|
for (const attr of attrs) {
|
||||||
if (attr[0] === 'src') {
|
if (attr[0] === 'src') {
|
||||||
hrefSrc = attr[1]
|
hrefSrc = attr[1]
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hrefSrc != null) {
|
if (hrefSrc != null) {
|
||||||
@ -51,7 +53,7 @@ const customRule = {
|
|||||||
lineNumber,
|
lineNumber,
|
||||||
`${detail} should exist in the file system`
|
`${detail} should exist in the file system`
|
||||||
)
|
)
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'link_open' && url.hash !== '') {
|
if (type === 'link_open' && url.hash !== '') {
|
||||||
@ -81,7 +83,7 @@ const customRule = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ const MarkdownIt = require('markdown-it')
|
|||||||
/**
|
/**
|
||||||
* Calls the provided function for each matching token.
|
* 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 {string} type Token type identifier.
|
||||||
* @param {Function} handler Callback function.
|
* @param {Function} handler Callback function.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
@ -19,12 +19,12 @@ const filterTokens = (params, type, handler) => {
|
|||||||
/**
|
/**
|
||||||
* Adds a generic error object via the onError callback.
|
* 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 {number} lineNumber Line number.
|
||||||
* @param {string} [detail] Error details.
|
* @param {string} [detail] Error details.
|
||||||
* @param {string} [context] Error context.
|
* @param {string} [context] Error context.
|
||||||
* @param {number[]} [range] Column and length of error.
|
* @param {number[]} [range] Column and length of error.
|
||||||
* @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
|
* @param {object} [fixInfo] RuleOnErrorFixInfo instance.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
const addError = (onError, lineNumber, detail, context, range, fixInfo) => {
|
const addError = (onError, lineNumber, detail, context, range, fixInfo) => {
|
||||||
@ -52,7 +52,6 @@ const convertHeadingToHTMLFragment = (inlineText) => {
|
|||||||
inlineText
|
inlineText
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
// RegExp source with Ruby's \p{Word} expanded into its General Categories
|
// 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://github.com/gjtorikian/html-pipeline/blob/main/lib/html/pipeline/toc_filter.rb
|
||||||
// https://ruby-doc.org/core-3.0.2/Regexp.html
|
// https://ruby-doc.org/core-3.0.2/Regexp.html
|
||||||
.replace(
|
.replace(
|
||||||
|
Loading…
Reference in New Issue
Block a user