mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-08 17:08:50 +01:00
Update MD053/link-image-reference-definitions to add ignored_definitions parameter (default to ["//"]) (fixes #545).
This commit is contained in:
parent
2c3e8c938b
commit
a6489acd6b
14 changed files with 234 additions and 31 deletions
|
|
@ -921,7 +921,7 @@ test("readme", (t) => new Promise((resolve) => {
|
|||
}));
|
||||
|
||||
test("rules", (t) => new Promise((resolve) => {
|
||||
t.plan(373);
|
||||
t.plan(374);
|
||||
fs.readFile("doc/Rules.md", "utf8",
|
||||
(err, contents) => {
|
||||
t.falsy(err);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,12 @@ https://example.com/multi-line-label
|
|||
[unique6]: https://example.com/unique6
|
||||
[unique7]: https://example.com/unique7
|
||||
|
||||
## Ignored Labels
|
||||
|
||||
[//]: # (This is a technique for putting comments in Markdown)
|
||||
|
||||
[//]: <> (Here is another variant)
|
||||
|
||||
## Invalid Labels
|
||||
|
||||
Duplicate:
|
||||
|
|
|
|||
13
test/reference-links-ignored-definitions-empty.md
Normal file
13
test/reference-links-ignored-definitions-empty.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Reference Links Ignored Definitions (Empty)
|
||||
|
||||
Used reference link: [label]
|
||||
|
||||
[label]: https://example.com/label
|
||||
[oops]: https://example.com/{MD053}
|
||||
[//]: <> ({MD053})
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"link-image-reference-definitions": {
|
||||
"ignored_definitions": []
|
||||
}
|
||||
} -->
|
||||
17
test/reference-links-ignored-definitions.md
Normal file
17
test/reference-links-ignored-definitions.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Reference Links Ignored Definitions
|
||||
|
||||
Used reference link: [label]
|
||||
|
||||
[label]: https://example.com/label
|
||||
[oops]: https://example.com/{MD053}
|
||||
[okay]: https://example.com/ignored
|
||||
[yep]: https://example.com/ignored
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"link-image-reference-definitions": {
|
||||
"ignored_definitions": [
|
||||
"okay",
|
||||
"yep"
|
||||
]
|
||||
}
|
||||
} -->
|
||||
|
|
@ -33768,7 +33768,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
25,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 196,
|
||||
lineNumber: 202,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md052',
|
||||
ruleNames: [
|
||||
|
|
@ -33784,7 +33784,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
10,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 210,
|
||||
lineNumber: 216,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md052',
|
||||
ruleNames: [
|
||||
|
|
@ -33802,7 +33802,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
fixInfo: {
|
||||
deleteCount: -1,
|
||||
},
|
||||
lineNumber: 172,
|
||||
lineNumber: 178,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
|
|
@ -33820,7 +33820,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
fixInfo: {
|
||||
deleteCount: -1,
|
||||
},
|
||||
lineNumber: 175,
|
||||
lineNumber: 181,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
|
|
@ -33838,7 +33838,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
fixInfo: {
|
||||
deleteCount: -1,
|
||||
},
|
||||
lineNumber: 178,
|
||||
lineNumber: 184,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
|
|
@ -33854,7 +33854,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
44,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 180,
|
||||
lineNumber: 186,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
|
|
@ -33870,7 +33870,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
44,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 183,
|
||||
lineNumber: 189,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
|
|
@ -34047,6 +34047,12 @@ Generated by [AVA](https://avajs.dev).
|
|||
[unique6]: https://example.com/unique6␊
|
||||
[unique7]: https://example.com/unique7␊
|
||||
␊
|
||||
## Ignored Labels␊
|
||||
␊
|
||||
[//]: # (This is a technique for putting comments in Markdown)␊
|
||||
␊
|
||||
[//]: <> (Here is another variant)␊
|
||||
␊
|
||||
## Invalid Labels␊
|
||||
␊
|
||||
Duplicate:␊
|
||||
|
|
@ -34089,6 +34095,107 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## reference-links-ignored-definitions-empty.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '[oops]: https://example.com/{M...',
|
||||
errorDetail: 'Unused link or image reference definition: "oops"',
|
||||
errorRange: [
|
||||
1,
|
||||
35,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: -1,
|
||||
},
|
||||
lineNumber: 6,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
'MD053',
|
||||
'link-image-reference-definitions',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[//]: <> ({MD053})',
|
||||
errorDetail: 'Unused link or image reference definition: "//"',
|
||||
errorRange: [
|
||||
1,
|
||||
18,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: -1,
|
||||
},
|
||||
lineNumber: 7,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
'MD053',
|
||||
'link-image-reference-definitions',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Reference Links Ignored Definitions (Empty)␊
|
||||
␊
|
||||
Used reference link: [label]␊
|
||||
␊
|
||||
[label]: https://example.com/label␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"link-image-reference-definitions": {␊
|
||||
"ignored_definitions": []␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## reference-links-ignored-definitions.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '[oops]: https://example.com/{M...',
|
||||
errorDetail: 'Unused link or image reference definition: "oops"',
|
||||
errorRange: [
|
||||
1,
|
||||
35,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: -1,
|
||||
},
|
||||
lineNumber: 6,
|
||||
ruleDescription: 'Link and image reference definitions should be needed',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md053',
|
||||
ruleNames: [
|
||||
'MD053',
|
||||
'link-image-reference-definitions',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Reference Links Ignored Definitions␊
|
||||
␊
|
||||
Used reference link: [label]␊
|
||||
␊
|
||||
[label]: https://example.com/label␊
|
||||
[okay]: https://example.com/ignored␊
|
||||
[yep]: https://example.com/ignored␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"link-image-reference-definitions": {␊
|
||||
"ignored_definitions": [␊
|
||||
"okay",␊
|
||||
"yep"␊
|
||||
]␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## required-headings-all-optional-at-least-one.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue