Skip to content

Commit

Permalink
maximum-line-length: fix long links
Browse files Browse the repository at this point in the history
Closes GH-318.
Closes GH-319.
  • Loading branch information
Trott committed Apr 17, 2024
1 parent 6b6ea9c commit 159d927
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/remark-lint-maximum-line-length/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
*
* <div>Mercury mercury mercury mercury mercury mercury mercury mercury mercury</div>
*
* Mercury
* <http://localhost/mercury/mercury/mercury/mercury/mercury/mercury/mercury/mercury>
* mercury mercury.
*
* [foo]: http://localhost/mercury/mercury/mercury/mercury/mercury/mercury/mercury/mercury
*
* @example
Expand Down Expand Up @@ -238,12 +242,15 @@ const remarkLintMaximumLineLength = lintRule(

const next = parent.children[index + 1]
const nextStart = pointStart(next)
const nextEnd = pointEnd(next)

// Not allowing when there’s a following child.
if (
next &&
nextStart &&
nextStart.line === start.line &&
nextEnd &&
nextEnd.line === start.line &&
// Either something with children:
(!('value' in next) ||
// Or with whitespace:
Expand Down
4 changes: 4 additions & 0 deletions packages/remark-lint-maximum-line-length/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ Mercury mercury mercury mercury mercury mercury mercury mercury mercury ![mercur

<div>Mercury mercury mercury mercury mercury mercury mercury mercury mercury</div>

Mercury
<http://localhost/mercury/mercury/mercury/mercury/mercury/mercury/mercury/mercury>
mercury mercury.

[foo]: http://localhost/mercury/mercury/mercury/mercury/mercury/mercury/mercury/mercury
```

Expand Down

0 comments on commit 159d927

Please sign in to comment.