mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Reimplement MD034/no-bare-urls using micromark tokens (fixes #707).
This commit is contained in:
parent
64159fa456
commit
b990b3ea77
22 changed files with 1495 additions and 947 deletions
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
|
@ -2800,6 +2800,164 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## bare-urls-in-html.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'https://example.com/fail',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
6,
|
||||
24,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 24,
|
||||
editColumn: 6,
|
||||
insertText: '<https://example.com/fail>',
|
||||
},
|
||||
lineNumber: 7,
|
||||
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/fail',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
49,
|
||||
24,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 24,
|
||||
editColumn: 49,
|
||||
insertText: '<https://example.com/fail>',
|
||||
},
|
||||
lineNumber: 11,
|
||||
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/fail',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
49,
|
||||
24,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 24,
|
||||
editColumn: 49,
|
||||
insertText: '<https://example.com/fail>',
|
||||
},
|
||||
lineNumber: 13,
|
||||
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/fail',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
41,
|
||||
24,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 24,
|
||||
editColumn: 41,
|
||||
insertText: '<https://example.com/fail>',
|
||||
},
|
||||
lineNumber: 19,
|
||||
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/fail',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
16,
|
||||
24,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 24,
|
||||
editColumn: 16,
|
||||
insertText: '<https://example.com/fail>',
|
||||
},
|
||||
lineNumber: 21,
|
||||
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/fail',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
17,
|
||||
24,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 24,
|
||||
editColumn: 17,
|
||||
insertText: '<https://example.com/fail>',
|
||||
},
|
||||
lineNumber: 23,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
'MD034',
|
||||
'no-bare-urls',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Bare URLs in HTML␊
|
||||
␊
|
||||
<p>␊
|
||||
https://example.com/pass␊
|
||||
</p>␊
|
||||
␊
|
||||
Text <https://example.com/fail> text. {MD034}␊
|
||||
␊
|
||||
Text <code>https://example.com/pass</code> text.␊
|
||||
␊
|
||||
Text <code>https://example.com/pass</code> text <https://example.com/fail> text. {MD034}␊
|
||||
␊
|
||||
Text <code>https://example.com/pass</code> text <https://example.com/fail> text <code>https://example.com/pass</code> text. {MD034}␊
|
||||
␊
|
||||
Text <em> text <strong>text</strong> https://example.com/pass </em> text.␊
|
||||
␊
|
||||
Text <em> text <em>text</em> https://example.com/pass </em> text.␊
|
||||
␊
|
||||
Text <em> text <em>text</em> text </em> <https://example.com/fail> text. {MD034}␊
|
||||
␊
|
||||
Text <br> text <https://example.com/fail> <br> text. {MD034}␊
|
||||
␊
|
||||
Text <br/> text <https://example.com/fail> <br/> text. {MD034}␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"line-length": false,␊
|
||||
"no-inline-html": false␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## bare-urls.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
@ -2986,6 +3144,26 @@ Generated by [AVA](https://avajs.dev).
|
|||
'no-bare-urls',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: 'user@example.com',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
40,
|
||||
16,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 16,
|
||||
editColumn: 40,
|
||||
insertText: '<user@example.com>',
|
||||
},
|
||||
lineNumber: 76,
|
||||
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␊
|
||||
␊
|
||||
|
|
@ -3059,6 +3237,12 @@ Generated by [AVA](https://avajs.dev).
|
|||
... when explicit: <https://example.com#heading->␊
|
||||
␊
|
||||
... when embedded: <code>https://example.com#heading-</code>␊
|
||||
␊
|
||||
Links with spaces inside angle brackets are okay: [blue jay](<https://en.wikipedia.org/wiki/Blue jay>)␊
|
||||
␊
|
||||
Email addresses are treated similarly: <user@example.com> {MD034}␊
|
||||
␊
|
||||
Angle brackets work the same for email: <user@example.com>␊
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
@ -10256,6 +10440,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
Text *emphasized* **strong** ___emphasized+strong___.␊
|
||||
Text \`code\` <strike>html</strike> <https://example.com/page>.␊
|
||||
Text [link](https://example.com/page) [link][] [link] ![image][link].␊
|
||||
Text https://example.com/page.␊
|
||||
␊
|
||||
Hard ␊
|
||||
line break␊
|
||||
|
|
@ -16679,6 +16864,22 @@ Generated by [AVA](https://avajs.dev).
|
|||
'no-inline-html',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Element: custom-element',
|
||||
errorRange: [
|
||||
1,
|
||||
35,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 120,
|
||||
ruleDescription: 'Inline HTML',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md033.md',
|
||||
ruleNames: [
|
||||
'MD033',
|
||||
'no-inline-html',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Detailed HTML Results␊
|
||||
␊
|
||||
|
|
@ -16798,6 +16999,13 @@ Generated by [AVA](https://avajs.dev).
|
|||
<details>␊
|
||||
␊
|
||||
{MD033:116}␊
|
||||
␊
|
||||
<custom-element attribute1="value1"␊
|
||||
attribute2="value2" />␊
|
||||
␊
|
||||
{MD033:120}␊
|
||||
␊
|
||||
Text <!-- <commented-out html="tag"> --> text.␊
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
@ -22836,26 +23044,6 @@ Generated by [AVA](https://avajs.dev).
|
|||
'no-bare-urls',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: 'ftp://user:password@ftp-server...',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
1,
|
||||
55,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 55,
|
||||
editColumn: 1,
|
||||
insertText: '<ftp://user:password@ftp-server.example.com/dir/file.txt>',
|
||||
},
|
||||
lineNumber: 11,
|
||||
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,
|
||||
|
|
@ -22868,7 +23056,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
editColumn: 2,
|
||||
insertText: '<https://example.com>',
|
||||
},
|
||||
lineNumber: 29,
|
||||
lineNumber: 20,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
|
|
@ -22877,18 +23065,18 @@ Generated by [AVA](https://avajs.dev).
|
|||
],
|
||||
},
|
||||
{
|
||||
errorContext: 'https://example.com',
|
||||
errorContext: 'https://example.com}',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
2,
|
||||
19,
|
||||
20,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 19,
|
||||
deleteCount: 20,
|
||||
editColumn: 2,
|
||||
insertText: '<https://example.com>',
|
||||
insertText: '<https://example.com}>',
|
||||
},
|
||||
lineNumber: 30,
|
||||
lineNumber: 21,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
|
|
@ -22908,7 +23096,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
editColumn: 3,
|
||||
insertText: '<https://example.com/>',
|
||||
},
|
||||
lineNumber: 36,
|
||||
lineNumber: 27,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
|
|
@ -22928,7 +23116,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
editColumn: 26,
|
||||
insertText: '<https://example.com/>',
|
||||
},
|
||||
lineNumber: 36,
|
||||
lineNumber: 27,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
|
|
@ -22947,8 +23135,6 @@ Generated by [AVA](https://avajs.dev).
|
|||
␊
|
||||
<hTtPs://gOoGlE.cOm/> {MD034}␊
|
||||
␊
|
||||
<ftp://user:password@ftp-server.example.com/dir/file.txt> {MD034}␊
|
||||
␊
|
||||
This link should be fine: <https://www.google.com/>␊
|
||||
␊
|
||||
The following are allowed to avoid conflicts with MD011/no-reversed-links:␊
|
||||
|
|
@ -22956,17 +23142,10 @@ Generated by [AVA](https://avajs.dev).
|
|||
[https://example.com]␊
|
||||
[https://example.com/search?query=text]␊
|
||||
␊
|
||||
The following are allowed to avoid conflicts with HTML-like syntax:␊
|
||||
␊
|
||||
"https://example.com"␊
|
||||
"https://example.com/search?query=text"␊
|
||||
'https://example.com'␊
|
||||
'https://example.com/search?query=text'␊
|
||||
␊
|
||||
Other enclosures are not allowed:␊
|
||||
␊
|
||||
(<https://example.com>) {MD034}␊
|
||||
{<https://example.com>} {MD034}␊
|
||||
{<https://example.com}> {MD034}␊
|
||||
␊
|
||||
Duplicate links in tables should be handled:␊
|
||||
␊
|
||||
|
|
@ -35200,6 +35379,26 @@ Generated by [AVA](https://avajs.dev).
|
|||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'https://example.com/footnote',
|
||||
errorDetail: null,
|
||||
errorRange: [
|
||||
7,
|
||||
28,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 28,
|
||||
editColumn: 7,
|
||||
insertText: '<https://example.com/footnote>',
|
||||
},
|
||||
lineNumber: 186,
|
||||
ruleDescription: 'Bare URL used',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md034.md',
|
||||
ruleNames: [
|
||||
'MD034',
|
||||
'no-bare-urls',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '[text][missing]',
|
||||
errorDetail: 'Missing link or image reference definition: "missing"',
|
||||
|
|
@ -35600,7 +35799,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
[unique8]: https://example.com/unique8␊
|
||||
[unique9]: https://example.com/unique9␊
|
||||
[unique10]: https://example.com/unique10␊
|
||||
[^1]: https://example.com/footnote␊
|
||||
[^1]: <https://example.com/footnote> {MD034}␊
|
||||
␊
|
||||
## Ignored Labels␊
|
||||
␊
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue