Warn when list looseness is incorrect, such as being tight
when it should be loose, and vice versa.
According to the markdown-style-guide,
if one or more list-items in a list spans more than one line,
the list is required to have blank lines between each item.
And otherwise, there should not be blank lines between items.
By default, all items must be “loose” (a blank line must be between
them) if one or more items are multiline (span more than one line).
Otherwise, the list must be tight (no blank line must be between
items).
If you pass {checkBlanks: true}
, all items must be “loose” if one or
more items contain blank lines. Otherwise, the list must be tight.
Install
npm install --save remark-lint-list-item-spacing
Example
When this rule is turned on, the following file
valid.md
is ok:
A tight list:
- item 1
- item 2
- item 3
A loose list:
- Wrapped
item
- item 2
- item 3
When this rule is turned on, the following file
invalid.md
is not ok:
A tight list:
- Wrapped
item
- item 2
- item 3
A loose list:
- item 1
- item 2
- item 3
4:9-5:1: Missing new line after list item
5:11-6:1: Missing new line after list item
11:1-12:1: Extraneous new line after list item
13:1-14:1: Extraneous new line after list item
When this rule is { checkBlanks: true }
, the following file
valid.md
is ok:
A tight list:
- item 1
- item 1.A
- item 2
> Blockquote
- item 3
```js
code()
```
A loose list:
- item 1
- item 1.A
- item 2
> Blockquote
- item 3
```js
code()
```
When this rule is { checkBlanks: true }
, the following file
invalid.md
is not ok:
A tight list:
- item 1
- item 1.A
- item 2
> Blockquote
- item 3
```js
code()
```
A loose list:
- item 1
- item 1.A
- item 2
> Blockquote
- item 3
```js
code()
```
5:15-6:1: Missing new line after list item
8:17-9:1: Missing new line after list item
19:1-20:1: Extraneous new line after list item
22:1-23:1: Extraneous new line after list item
License
MIT © Titus Wormer