mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Update MD052/reference-links-images to add ignored_labels parameter and default to ignoring GFM task list items (fixes #1524).
This commit is contained in:
parent
c413ac9a88
commit
328506e6c8
19 changed files with 357 additions and 12 deletions
|
|
@ -908,7 +908,7 @@ test("readme", async(t) => {
|
|||
});
|
||||
|
||||
test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
||||
t.plan(199);
|
||||
t.plan(201);
|
||||
// @ts-ignore
|
||||
const ajv = new Ajv(ajvOptions);
|
||||
const validateSchemaStrict = ajv.compile(configSchemaStrict);
|
||||
|
|
|
|||
19
test/reference-links-and-images-ignored-labels-empty.md
Normal file
19
test/reference-links-and-images-ignored-labels-empty.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Reference Links and Images (Ignored Labels Empty)
|
||||
|
||||
[full][full] {MD052}
|
||||
|
||||
[collapsed][] {MD052}
|
||||
|
||||
[shortcut] {MD052}
|
||||
|
||||
[invalid][invalid] {MD052}
|
||||
|
||||
- [ ] Unchecked task list item
|
||||
- [x] Checked task list item {MD052}
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"reference-links-images": {
|
||||
"ignored_labels": [],
|
||||
"shortcut_syntax": true
|
||||
}
|
||||
} -->
|
||||
23
test/reference-links-and-images-ignored-labels.md
Normal file
23
test/reference-links-and-images-ignored-labels.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Reference Links and Images (Ignored Labels)
|
||||
|
||||
[full][full]
|
||||
|
||||
[collapsed][]
|
||||
|
||||
[shortcut]
|
||||
|
||||
[invalid][invalid] {MD052}
|
||||
|
||||
- [ ] Unchecked task list item
|
||||
- [x] Checked task list item {MD052}
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"reference-links-images": {
|
||||
"ignored_labels": [
|
||||
"full",
|
||||
"collapsed",
|
||||
"shortcut"
|
||||
],
|
||||
"shortcut_syntax": true
|
||||
}
|
||||
} -->
|
||||
|
|
@ -84,6 +84,16 @@ Footnote[^1]
|
|||
|
||||
Missing[^2] {MD052}
|
||||
|
||||
## GitHub Flavored Markdown Task List Items
|
||||
|
||||
- [ ] Unchecked task list item
|
||||
- [x] Checked task list item
|
||||
|
||||
- [x] alpha
|
||||
- [ ] beta
|
||||
- [x] charlie
|
||||
- [ ] delta
|
||||
|
||||
## Valid Labels
|
||||
|
||||
[label]: https://example.com/label
|
||||
|
|
|
|||
|
|
@ -242,3 +242,8 @@ Text with a [^footnote] in it
|
|||
[^footnote]: Footnote with an [embedded-reference][] in it
|
||||
|
||||
[embedded-reference]: https://example.com/embedded-reference
|
||||
|
||||
## GitHub Flavored Markdown Task List Items
|
||||
|
||||
- [ ] Unchecked task list item
|
||||
- [x] Checked task list item
|
||||
|
|
|
|||
|
|
@ -47639,6 +47639,180 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## reference-links-and-images-ignored-labels-empty.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '[full][full]',
|
||||
errorDetail: 'Missing link or image reference definition: "full"',
|
||||
errorRange: [
|
||||
1,
|
||||
12,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 3,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[collapsed][]',
|
||||
errorDetail: 'Missing link or image reference definition: "collapsed"',
|
||||
errorRange: [
|
||||
1,
|
||||
13,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 5,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[shortcut]',
|
||||
errorDetail: 'Missing link or image reference definition: "shortcut"',
|
||||
errorRange: [
|
||||
1,
|
||||
10,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 7,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[invalid][invalid]',
|
||||
errorDetail: 'Missing link or image reference definition: "invalid"',
|
||||
errorRange: [
|
||||
1,
|
||||
18,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 9,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[x]',
|
||||
errorDetail: 'Missing link or image reference definition: "x"',
|
||||
errorRange: [
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 12,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Reference Links and Images (Ignored Labels Empty)␊
|
||||
␊
|
||||
[full][full] {MD052}␊
|
||||
␊
|
||||
[collapsed][] {MD052}␊
|
||||
␊
|
||||
[shortcut] {MD052}␊
|
||||
␊
|
||||
[invalid][invalid] {MD052}␊
|
||||
␊
|
||||
- [ ] Unchecked task list item␊
|
||||
- [x] Checked task list item {MD052}␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"reference-links-images": {␊
|
||||
"ignored_labels": [],␊
|
||||
"shortcut_syntax": true␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## reference-links-and-images-ignored-labels.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '[invalid][invalid]',
|
||||
errorDetail: 'Missing link or image reference definition: "invalid"',
|
||||
errorRange: [
|
||||
1,
|
||||
18,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 9,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[x]',
|
||||
errorDetail: 'Missing link or image reference definition: "x"',
|
||||
errorRange: [
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 12,
|
||||
ruleDescription: 'Reference links and images should use a label that is defined',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
|
||||
ruleNames: [
|
||||
'MD052',
|
||||
'reference-links-images',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Reference Links and Images (Ignored Labels)␊
|
||||
␊
|
||||
[full][full]␊
|
||||
␊
|
||||
[collapsed][]␊
|
||||
␊
|
||||
[shortcut]␊
|
||||
␊
|
||||
[invalid][invalid] {MD052}␊
|
||||
␊
|
||||
- [ ] Unchecked task list item␊
|
||||
- [x] Checked task list item {MD052}␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"reference-links-images": {␊
|
||||
"ignored_labels": [␊
|
||||
"full",␊
|
||||
"collapsed",␊
|
||||
"shortcut"␊
|
||||
],␊
|
||||
"shortcut_syntax": true␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## reference-links-and-images-shortcuts.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
@ -47657,7 +47831,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
editColumn: 7,
|
||||
insertText: '<https://example.com/footnote>',
|
||||
},
|
||||
lineNumber: 106,
|
||||
lineNumber: 116,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
|
|
@ -47848,6 +48022,16 @@ Generated by [AVA](https://avajs.dev).
|
|||
␊
|
||||
Missing[^2] {MD052}␊
|
||||
␊
|
||||
## GitHub Flavored Markdown Task List Items␊
|
||||
␊
|
||||
- [ ] Unchecked task list item␊
|
||||
- [x] Checked task list item␊
|
||||
␊
|
||||
- [x] alpha␊
|
||||
- [ ] beta␊
|
||||
- [x] charlie␊
|
||||
- [ ] delta␊
|
||||
␊
|
||||
## Valid Labels␊
|
||||
␊
|
||||
[label]: https://example.com/label␊
|
||||
|
|
@ -48359,6 +48543,11 @@ Generated by [AVA](https://avajs.dev).
|
|||
[^footnote]: Footnote with an [embedded-reference][] in it␊
|
||||
␊
|
||||
[embedded-reference]: https://example.com/embedded-reference␊
|
||||
␊
|
||||
## GitHub Flavored Markdown Task List Items␊
|
||||
␊
|
||||
- [ ] Unchecked task list item␊
|
||||
- [x] Checked task list item␊
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue