mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-06 07:58:49 +01:00
Update MD013/line-length to allow inline image links to exceed the length threshold (fixes #248).
This commit is contained in:
parent
74af9f82fb
commit
26ad0550ec
2 changed files with 20 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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")**
|
||||
|
||||

|
||||
|
||||
**
|
||||
|
||||
****
|
||||
|
||||
![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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue