Update MD034/no-bare-urls to better handle multiple similar issues on the same line (fixes https://github.com/igorshubovych/markdownlint-cli/issues/339).

This commit is contained in:
David Anson 2022-12-06 22:14:40 -08:00
parent ce5d393109
commit cba5e8d340
7 changed files with 290 additions and 119 deletions

View file

@ -2998,6 +2998,24 @@ Generated by [AVA](https://avajs.dev).
<br> Another violation: <https://example.com>. {MD034} <br>
<br/> Another violation: <https://example.com>. {MD034} <br/>
This is not a bare [link]( https://example.com ).␊
URLs in HTML are not bare:␊
<element-name first-attribute=" https://example.com/first " second-attribute=" https://example.com/second ">
Text␊
</element-name>
<element-name
first-attribute=" https://example.com/first "␊
second-attribute=" https://example.com/second "></element-name>
URLs in link and image text are not bare:␊
Text [link to https://example.com site](https://example.com) text.␊
Image ![for https://example.com site](https://example.com) text.␊
`,
}
@ -21928,8 +21946,15 @@ Generated by [AVA](https://avajs.dev).
{
errorContext: 'https://example.com/same',
errorDetail: null,
errorRange: null,
fixInfo: null,
errorRange: [
46,
24,
],
fixInfo: {
deleteCount: 24,
editColumn: 46,
insertText: '<https://example.com/same>',
},
lineNumber: 26,
ruleDescription: 'Bare URL used',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
@ -22144,7 +22169,7 @@ Generated by [AVA](https://avajs.dev).
Text <https://example.com/same> more text <https://example.com/same> still more text <https://example.com/same> done {MD034}␊
Text <https://example.com/same> more \\* text https://example.com/same more \\[ text <https://example.com/same> done {MD034}␊
Text <https://example.com/same> more \\* text <https://example.com/same> more \\[ text <https://example.com/same> done {MD034}␊
Text <https://example.com/first> more text <https://example.com/second> still more text <https://example.com/third> done {MD034}␊
@ -22379,6 +22404,46 @@ Generated by [AVA](https://avajs.dev).
'no-bare-urls',
],
},
{
errorContext: 'https://example.com/',
errorDetail: null,
errorRange: [
3,
20,
],
fixInfo: {
deleteCount: 20,
editColumn: 3,
insertText: '<https://example.com/>',
},
lineNumber: 36,
ruleDescription: 'Bare URL used',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
ruleNames: [
'MD034',
'no-bare-urls',
],
},
{
errorContext: 'https://example.com/',
errorDetail: null,
errorRange: [
26,
20,
],
fixInfo: {
deleteCount: 20,
editColumn: 26,
insertText: '<https://example.com/>',
},
lineNumber: 36,
ruleDescription: 'Bare URL used',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
ruleNames: [
'MD034',
'no-bare-urls',
],
},
],
fixed: `# Link test␊
@ -22410,6 +22475,12 @@ Generated by [AVA](https://avajs.dev).
(<https://example.com>) {MD034}␊
{<https://example.com>} {MD034}␊
Duplicate links in tables should be handled:␊
| Link | Same Link | Violation |␊
|----------------------|----------------------|-----------|␊
| <https://example.com/> | <https://example.com/> | {MD034} |␊
`,
}