mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD013/line-length to allow long lines composed only of emphasized/strong links (fixes #67).
This commit is contained in:
parent
0c38635afe
commit
1dce3e45d3
2 changed files with 38 additions and 3 deletions
19
lib/rules.js
19
lib/rules.js
|
@ -448,11 +448,24 @@ module.exports = [
|
|||
headerLineNumbers.push(heading.lineNumber);
|
||||
});
|
||||
}
|
||||
var tokenTypeMap = {
|
||||
"em_open": "e",
|
||||
"em_close": "E",
|
||||
"link_open": "l",
|
||||
"link_close": "L",
|
||||
"strong_open": "s",
|
||||
"strong_close": "S",
|
||||
"text": "T"
|
||||
};
|
||||
var linkOnlyLineNumbers = [];
|
||||
filterTokens(params, "inline", function forToken(token) {
|
||||
if (((token.children.length === 2) || (token.children.length === 3)) &&
|
||||
(token.children[0].type === "link_open") &&
|
||||
(token.children[token.children.length - 1].type === "link_close")) {
|
||||
var childTokenTypes = "";
|
||||
token.children.forEach(function forChild(child) {
|
||||
if (child.type !== "text" || child.content !== "") {
|
||||
childTokenTypes += tokenTypeMap[child.type] || "x";
|
||||
}
|
||||
});
|
||||
if (/^[es]*lT?L[ES]*$/.test(childTokenTypes)) {
|
||||
linkOnlyLineNumbers.push(token.lineNumber);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,6 +8,10 @@ This line however, while very long, doesn't have whitespace after the 80th colum
|
|||
|
||||
[This long line is comprised entirely of a link](http://example.com "But is inside a code block") {MD013}
|
||||
|
||||
```md
|
||||
[This long line is comprised entirely of a link](http://example.com "But is inside a code block") {MD013}
|
||||
```
|
||||
|
||||
This [long line is comprised mostly of a link](http://example.com "This is the long link's title") {MD013}
|
||||
|
||||
[This long line is comprised mostly of a link](http://example.com "This is the long link's title") text {MD013}
|
||||
|
@ -21,3 +25,21 @@ This long line includes a simple [reference][label] link and is long enough to v
|
|||
[Link to broken label][notlabel]
|
||||
|
||||
[notlabel\]: notlink "Invalid syntax for a link label because the right bracket is backslash-escaped {MD013}"
|
||||
|
||||
[](http://example.com "This long line is comprised entirely of a link with empty text and a non-empty title")
|
||||
|
||||
*[This long line is comprised of an emphasized link](http://example.com "This is the long link's title")*
|
||||
|
||||
_[This long line is comprised of an emphasized link](http://example.com "This is the long link's title")_
|
||||
|
||||
**[This long line is comprised of a bolded link](http://example.com "This is the long link's title")**
|
||||
|
||||
__[This long line is comprised of a bolded link](http://example.com "This is the long link's title")__
|
||||
|
||||
_**[This long line is comprised of an emphasized and bolded link](http://example.com "This is the long link's title")**_
|
||||
|
||||
**_[This long line is comprised of an emphasized and bolded link](http://example.com "This is the long link's title")_**
|
||||
|
||||
*[](http://example.com "This long line is comprised of an emphasized link with empty text and a non-empty title")*
|
||||
|
||||
**[](http://example.com "This long line is comprised of a bolded link with empty text and a non-empty title")**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue