Update MD013/line-length to allow long lines composed only of emphasized/strong links (fixes #67).

This commit is contained in:
David Anson 2017-10-28 14:58:34 -07:00
parent 0c38635afe
commit 1dce3e45d3
2 changed files with 38 additions and 3 deletions

View file

@ -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);
}
});