Update MD053/link-image-reference-definitions to add ignored_definitions parameter (default to ["//"]) (fixes #545).

This commit is contained in:
David Anson 2022-08-02 20:36:47 -07:00
parent 2c3e8c938b
commit a6489acd6b
14 changed files with 234 additions and 31 deletions

View file

@ -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