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);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue