Update MD034/no-bare-urls to re-scan documents with potential violations using proper reference definition handling to avoid false positives (fixes #787).

This commit is contained in:
David Anson 2023-05-23 04:01:55 +00:00
parent 054f208e9a
commit 488813f7f7
7 changed files with 136 additions and 102 deletions

View file

@ -3247,26 +3247,6 @@ Generated by [AVA](https://avajs.dev).
'no-bare-urls',
],
},
{
errorContext: 'https://example.com',
errorDetail: null,
errorRange: [
45,
19,
],
fixInfo: {
deleteCount: 19,
editColumn: 45,
insertText: '<https://example.com>',
},
lineNumber: 86,
ruleDescription: 'Bare URL used',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
ruleNames: [
'MD034',
'no-bare-urls',
],
},
],
fixed: `# Detailed Results Bare URLs␊
@ -3353,10 +3333,9 @@ Generated by [AVA](https://avajs.dev).
Links bind to the innermost [link that [is-a-valid] link](<https://example.com>) {MD034}␊
But not if the [link [is-not-a-valid] link](<https://example.com>) {MD034}␊
HOWEVER this scenario could have an invalid shortcut and IS reported␊
But not if the [link [is-not-a-valid] link](https://example.com)␊
Escaping both inner square brackets avoids the unwanted report:␊
Escaping both inner square brackets avoids confusion:␊
[link \\[is-not-a-valid\\] link](https://example.com)␊
`,
}
@ -23985,6 +23964,26 @@ Generated by [AVA](https://avajs.dev).
'no-bare-urls',
],
},
{
errorContext: 'https://example.com',
errorDetail: null,
errorRange: [
43,
19,
],
fixInfo: {
deleteCount: 19,
editColumn: 43,
insertText: '<https://example.com>',
},
lineNumber: 30,
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␊
@ -24013,6 +24012,11 @@ Generated by [AVA](https://avajs.dev).
| Link | Same Link | Violation |␊
|----------------------|----------------------|-----------|␊
| <https://example.com/> | <https://example.com/> | {MD034} |␊
This is not a bare URL: [text [undefined] text](https://example.com).␊
This is a bare URL: [text [defined] text](<https://example.com>). {MD034}␊
[defined]: https://example.com␊
`,
}