mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update bare URL RegExp to improve the behavior of MD034/no-bare-urls with trailing punctuation (fixes #283).
This commit is contained in:
parent
e696960aab
commit
6ac5fa52a6
4 changed files with 119 additions and 1 deletions
|
@ -21,7 +21,7 @@ const inlineCommentRe =
|
|||
module.exports.inlineCommentRe = inlineCommentRe;
|
||||
|
||||
// Regular expressions for range matching
|
||||
module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*/ig;
|
||||
module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*(?:\/|[^\s\]"'\W])/ig;
|
||||
module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
|
||||
module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
|
||||
|
||||
|
|
13
test/detailed-results-bare-urls.md
Normal file
13
test/detailed-results-bare-urls.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Detailed Results Bare URLs
|
||||
|
||||
For more, see https://example.com.
|
||||
|
||||
For more, see https://example.com/.
|
||||
|
||||
For more, see https://example.com/?query=string#hash.
|
||||
|
||||
For more, see https://example.com/info.htm.
|
||||
|
||||
Visit https://example.com, then refresh.
|
||||
|
||||
The site (https://example.com) is down.
|
13
test/detailed-results-bare-urls.md.fixed
Normal file
13
test/detailed-results-bare-urls.md.fixed
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Detailed Results Bare URLs
|
||||
|
||||
For more, see <https://example.com>.
|
||||
|
||||
For more, see <https://example.com/>.
|
||||
|
||||
For more, see <https://example.com/?query=string#hash>.
|
||||
|
||||
For more, see <https://example.com/info.htm>.
|
||||
|
||||
Visit <https://example.com>, then refresh.
|
||||
|
||||
The site (<https://example.com>) is down.
|
92
test/detailed-results-bare-urls.results.json
Normal file
92
test/detailed-results-bare-urls.results.json
Normal file
|
@ -0,0 +1,92 @@
|
|||
[
|
||||
{
|
||||
"lineNumber": 3,
|
||||
"ruleNames": [
|
||||
"MD034",
|
||||
"no-bare-urls"
|
||||
],
|
||||
"ruleDescription": "Bare URL used",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034",
|
||||
"errorDetail": null,
|
||||
"errorContext": "https://example.com",
|
||||
"errorRange": [
|
||||
15,
|
||||
19
|
||||
]
|
||||
},
|
||||
{
|
||||
"lineNumber": 5,
|
||||
"ruleNames": [
|
||||
"MD034",
|
||||
"no-bare-urls"
|
||||
],
|
||||
"ruleDescription": "Bare URL used",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034",
|
||||
"errorDetail": null,
|
||||
"errorContext": "https://example.com/",
|
||||
"errorRange": [
|
||||
15,
|
||||
20
|
||||
]
|
||||
},
|
||||
{
|
||||
"lineNumber": 7,
|
||||
"ruleNames": [
|
||||
"MD034",
|
||||
"no-bare-urls"
|
||||
],
|
||||
"ruleDescription": "Bare URL used",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034",
|
||||
"errorDetail": null,
|
||||
"errorContext": "https://example.com/?query=str...",
|
||||
"errorRange": [
|
||||
15,
|
||||
38
|
||||
]
|
||||
},
|
||||
{
|
||||
"lineNumber": 9,
|
||||
"ruleNames": [
|
||||
"MD034",
|
||||
"no-bare-urls"
|
||||
],
|
||||
"ruleDescription": "Bare URL used",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034",
|
||||
"errorDetail": null,
|
||||
"errorContext": "https://example.com/info.htm",
|
||||
"errorRange": [
|
||||
15,
|
||||
28
|
||||
]
|
||||
},
|
||||
{
|
||||
"lineNumber": 11,
|
||||
"ruleNames": [
|
||||
"MD034",
|
||||
"no-bare-urls"
|
||||
],
|
||||
"ruleDescription": "Bare URL used",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034",
|
||||
"errorDetail": null,
|
||||
"errorContext": "https://example.com",
|
||||
"errorRange": [
|
||||
7,
|
||||
19
|
||||
]
|
||||
},
|
||||
{
|
||||
"lineNumber": 13,
|
||||
"ruleNames": [
|
||||
"MD034",
|
||||
"no-bare-urls"
|
||||
],
|
||||
"ruleDescription": "Bare URL used",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034",
|
||||
"errorDetail": null,
|
||||
"errorContext": "https://example.com",
|
||||
"errorRange": [
|
||||
11,
|
||||
19
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue