mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2025-05-21 23:21:07 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9bb5ffe0ae | |||
876384344c | |||
70bdb7013e | |||
db57d67b0b |
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"config": {
|
|
||||||
"extends": "markdownlint/style/prettier",
|
|
||||||
"default": true,
|
|
||||||
"relative-links": true,
|
|
||||||
"no-inline-html": false,
|
|
||||||
},
|
|
||||||
"globs": ["**/*.md"],
|
|
||||||
"ignores": ["**/node_modules", "**/test/fixtures/**"],
|
|
||||||
"customRules": ["./src/index.js"],
|
|
||||||
}
|
|
15
.markdownlint-cli2.mjs
Normal file
15
.markdownlint-cli2.mjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import relativeLinksRule from "./src/index.js"
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
config: {
|
||||||
|
extends: "markdownlint/style/prettier",
|
||||||
|
default: true,
|
||||||
|
"relative-links": true,
|
||||||
|
"no-inline-html": false,
|
||||||
|
},
|
||||||
|
globs: ["**/*.md"],
|
||||||
|
ignores: ["**/node_modules", "**/test/fixtures/**"],
|
||||||
|
customRules: [relativeLinksRule],
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
22
README.md
22
README.md
@ -80,18 +80,22 @@ There are various ways [markdownlint](https://github.com/DavidAnson/markdownlint
|
|||||||
|
|
||||||
We recommend configuring [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) over [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) for compatibility with the [vscode-markdownlint](https://github.com/DavidAnson/vscode-markdownlint) extension.
|
We recommend configuring [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) over [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) for compatibility with the [vscode-markdownlint](https://github.com/DavidAnson/vscode-markdownlint) extension.
|
||||||
|
|
||||||
`.markdownlint-cli2.jsonc`
|
`.markdownlint-cli2.mjs`
|
||||||
|
|
||||||
```json
|
```js
|
||||||
{
|
import relativeLinksRule from "markdownlint-rule-relative-links"
|
||||||
"config": {
|
|
||||||
"default": true,
|
const config = {
|
||||||
"relative-links": true
|
config: {
|
||||||
|
default: true,
|
||||||
|
"relative-links": true,
|
||||||
},
|
},
|
||||||
"globs": ["**/*.md"],
|
globs: ["**/*.md"],
|
||||||
"ignores": ["**/node_modules"],
|
ignores: ["**/node_modules"],
|
||||||
"customRules": ["markdownlint-rule-relative-links"]
|
customRules: [relativeLinksRule],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
```
|
```
|
||||||
|
|
||||||
`package.json`
|
`package.json`
|
||||||
|
2596
package-lock.json
generated
2596
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -44,19 +44,19 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/markdown-it": "14.1.2",
|
"@types/markdown-it": "14.1.2",
|
||||||
"@types/node": "22.10.2",
|
"@types/node": "22.15.17",
|
||||||
"editorconfig-checker": "6.0.0",
|
"editorconfig-checker": "6.0.1",
|
||||||
"eslint": "9.17.0",
|
"eslint": "9.26.0",
|
||||||
"eslint-config-conventions": "18.0.0",
|
"eslint-config-conventions": "19.2.0",
|
||||||
"eslint-plugin-promise": "7.2.1",
|
"eslint-plugin-promise": "7.2.1",
|
||||||
"eslint-plugin-unicorn": "56.0.1",
|
"eslint-plugin-unicorn": "59.0.1",
|
||||||
"eslint-plugin-import-x": "4.6.1",
|
"eslint-plugin-import-x": "4.11.1",
|
||||||
"globals": "15.14.0",
|
"globals": "16.1.0",
|
||||||
"markdownlint": "0.37.2",
|
"markdownlint": "0.38.0",
|
||||||
"markdownlint-cli2": "0.17.0",
|
"markdownlint-cli2": "0.18.0",
|
||||||
"prettier": "3.4.2",
|
"prettier": "3.5.3",
|
||||||
"semantic-release": "24.2.0",
|
"semantic-release": "24.2.3",
|
||||||
"typescript-eslint": "8.18.2",
|
"typescript-eslint": "8.32.0",
|
||||||
"typescript": "5.7.2"
|
"typescript": "5.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
src/index.d.ts
vendored
5
src/index.d.ts
vendored
@ -1,5 +1,8 @@
|
|||||||
|
import type MarkdownIt from "markdown-it"
|
||||||
import type { Rule } from "markdownlint"
|
import type { Rule } from "markdownlint"
|
||||||
|
|
||||||
declare const relativeLinksRule: Rule
|
declare const relativeLinksRule: Rule
|
||||||
|
|
||||||
export default relativeLinksRule
|
export default relativeLinksRule
|
||||||
|
|
||||||
|
declare const markdownIt: MarkdownIt
|
||||||
|
export { markdownIt }
|
||||||
|
@ -12,6 +12,8 @@ import {
|
|||||||
lineFragmentRe,
|
lineFragmentRe,
|
||||||
} from "./utils.js"
|
} from "./utils.js"
|
||||||
|
|
||||||
|
export { markdownIt } from "./utils.js"
|
||||||
|
|
||||||
/** @typedef {import('markdownlint').Rule} MarkdownLintRule */
|
/** @typedef {import('markdownlint').Rule} MarkdownLintRule */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@ import MarkdownIt from "markdown-it"
|
|||||||
|
|
||||||
import { getHtmlAttributeRe } from "./markdownlint-rule-helpers/helpers.js"
|
import { getHtmlAttributeRe } from "./markdownlint-rule-helpers/helpers.js"
|
||||||
|
|
||||||
const markdownIt = new MarkdownIt({ html: true })
|
export const markdownIt = new MarkdownIt({ html: true })
|
||||||
|
|
||||||
export const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/
|
export const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import assert from "node:assert/strict"
|
|||||||
|
|
||||||
import * as markdownlint from "markdownlint/promise"
|
import * as markdownlint from "markdownlint/promise"
|
||||||
|
|
||||||
import relativeLinksRule from "../src/index.js"
|
import relativeLinksRule, { markdownIt } from "../src/index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -18,6 +18,9 @@ const validateMarkdownLint = async (fixtureFile) => {
|
|||||||
"relative-links": true,
|
"relative-links": true,
|
||||||
},
|
},
|
||||||
customRules: [relativeLinksRule],
|
customRules: [relativeLinksRule],
|
||||||
|
markdownItFactory: () => {
|
||||||
|
return markdownIt
|
||||||
|
},
|
||||||
})
|
})
|
||||||
return lintResults[fixtureFile]
|
return lintResults[fixtureFile]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user