mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Re-implement MD011/no-reversed-links for better accuracy (range and fixInfo are now always valid) (fixes #398).
This commit is contained in:
parent
646a67b8bd
commit
706f48bd25
6 changed files with 165 additions and 91 deletions
|
@ -1,17 +1,26 @@
|
|||
# reversed_link
|
||||
|
||||
Go to [this website](https://www.example.com)
|
||||
|
||||
Go to (this website)[https://www.example.com] {MD011}
|
||||
|
||||
Go to (this)[website](https://www.example.com)
|
||||
|
||||
However, this shouldn't trigger inside code blocks:
|
||||
|
||||
myObj.getFiles("test")[0]
|
||||
|
||||
Nor code fences:
|
||||
|
||||
```js
|
||||
myObj.getFiles(test)[0];
|
||||
```
|
||||
|
||||
Nor inline code: `myobj.getFiles("test")[0]`
|
||||
|
||||
Two (issues)[https://www.example.com/one] in {MD011}
|
||||
the (same text)[https://www.example.com/two]. {MD011}
|
||||
|
||||
<!-- markdownlint-disable line-length -->
|
||||
Two (issues)[https://www.example.com/three] on the (same line)[https://www.example.com/four]. {MD011}
|
||||
|
||||
`code code
|
||||
|
@ -31,16 +40,40 @@ var IDENT_RE = '([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*'; {MD011}
|
|||
|
||||
begin: /\B(([\/.])[\w\-.\/=]+)+/, {MD011}
|
||||
|
||||
{begin: '%r\\(', end: '\\)[a-z]*'} {MD011}
|
||||
{begin: '%r\\(', end: '\\)[a-z]*'}
|
||||
|
||||
return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str); {MD011}
|
||||
|
||||
## Escaped Parens
|
||||
|
||||
(reversed)[link] {MD011}
|
||||
(reversed)[link]
|
||||
|
||||
a ) a ( a )[a]~ {MD011}
|
||||
a ) a ( a )[a]~
|
||||
|
||||
<!-- markdownlint-disable no-inline-html-->
|
||||
a<pre>) a ( a )[a]~</pre>
|
||||
|
||||
a<pre>) a ( a )[a]~</pre> {MD011}
|
||||
## Backslash Escapes
|
||||
|
||||
xxx(xxx)[xxx] {MD011}
|
||||
|
||||
xxx\(xxx)[xxx]
|
||||
|
||||
xxx(xxx\)[xxx]
|
||||
|
||||
xxx(xxx)\[xxx]
|
||||
|
||||
xxx(xxx)[xxx\]
|
||||
|
||||
## Consecutive Links
|
||||
|
||||
text [link](destination) text [link](destination) text
|
||||
text [link](destination)[link](destination) text
|
||||
text [link](destination)[link](destination)[link](destination) text
|
||||
|
||||
text (reversed)[link] text (reversed)[link] text {MD011}
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"code-block-style": false,
|
||||
"line-length": false,
|
||||
"no-inline-html": false
|
||||
} -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue