diff --git a/lib/md013.js b/lib/md013.js index 5f273208..56a6d7d3 100644 --- a/lib/md013.js +++ b/lib/md013.js @@ -10,10 +10,11 @@ const longLineRePrefix = "^.{"; const longLineRePostfixRelaxed = "}.*\\s.*$"; const longLineRePostfixStrict = "}.+$"; const labelRe = /^\s*\[.*[^\\]]:/; -const linkOnlyLineRe = /^[es]*lT?L[ES]*$/; +const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/; const tokenTypeMap = { "em_open": "e", "em_close": "E", + "image": "I", "link_open": "l", "link_close": "L", "strong_open": "s", @@ -59,7 +60,7 @@ module.exports = { childTokenTypes += tokenTypeMap[child.type] || "x"; } }); - if (linkOnlyLineRe.test(childTokenTypes)) { + if (linkOrImageOnlyLineRe.test(childTokenTypes)) { linkOnlyLineNumbers.push(token.lineNumber); } }); diff --git a/test/long_lines.md b/test/long_lines.md index 8238e645..17b61371 100644 --- a/test/long_lines.md +++ b/test/long_lines.md @@ -1,3 +1,5 @@ +# Long Lines + This is a very very very very very very very very very very very very very very long line {MD013} This line however, while very long, doesn't have whitespace after the 80th columnwhichallowsforURLsandotherlongthings. @@ -9,7 +11,7 @@ This line however, while very long, doesn't have whitespace after the 80th colum [This long line is comprised entirely of a link](https://example.com "But is inside a code block") {MD013} ```markdown -[This long line is comprised entirely of a link](https://example.com "But is inside a code block") {MD013} {MD046:11} +[This long line is comprised entirely of a link](https://example.com "But is inside a code block") {MD013} {MD046:13} ``` This [long line is comprised mostly of a link](https://example.com "This is the long link's title") {MD013} @@ -43,3 +45,17 @@ _**[This long line is comprised of an emphasized and bolded link](https://exampl *[](https://example.com "This long line is comprised of an emphasized link with empty text and a non-empty title")* **[](https://example.com "This long line is comprised of a bolded link with empty text and a non-empty title")** + +![Alternate text for long line image example](https://example.com "Title text for long line image example") + +*![Alternate text for long line image example](https://example.com "Title text for long line image example")* + +**![Alternate text for long line image example](https://example.com "Title text for long line image example")** + +![Reference style for long line image which is itself an example of a long line with content][image] + +*![Reference style for long line image which is itself an example of a long line with content][image]* + +**![Reference style for long line image which is itself an example of a long line with content][image]** + +[image]: https://example.com "Title text for long line image example using reference style for image details"