remark-lint
remark-lint copied to clipboard
Remark rules do not seem to account for sub-bullets
In Markdown, it is common to have a list with sub-bullets. For example:
- The first thing.
- Here's a second thing.
- But beware that the second thing does not apply all of the time!
- There is also a third thing.
On GitHub, this is auto-formatted to:
- The first thing.
- Here's a second thing.
- But beware that the second thing does not apply all of the time!
- There is also a third thing.
I'm using the following .remarkrc
file:
{
"plugins": [
"remark-preset-lint-consistent",
"remark-preset-lint-markdown-style-guide",
"remark-preset-lint-recommended"
]
}
With the following version:
remark: 13.0.0, remark-cli: 9.0.0
In remark-lint
land, the list-item-indent
will choke on this code snippet with the following warning:
test.md
1:3 warning Incorrect list-item indent: add 2 spaces list-item-indent remark-lint
However, this is a pretty bad suggestion, because when we follow the advice:
- The first thing.
- Here's a second thing.
- But beware that the second thing does not apply all of the time!
- There is also a third thing.
GitHub will incorrectly format that to:
- The first thing.
- Here's a second thing.
- But beware that the second thing does not apply all of the time! <----- It removed this sub-bullet.
- There is also a third thing.
No problem. Let's just ignore this particular rule, the list-item-indent
rule.
However, remark-lint
still chokes:
test.md
1:19-2:1 warning Missing new line after list item list-item-spacing remark-lint
3:4 warning Don’t use mixed indentation for children, remove 1 space list-item-content-indent remark-lint
- The
list-item-spacing
logic does not understand that this is a "tight" list, so it spuriously wants a new line. - The
list-item-content-indent
doesn't understand that sub-bullets exist and assumes that you made a typo.
Right now, I am completely disabling all 3 of these rules (e.g. list-item-indent
, list-item-content-indent
list-item-spacing
), but it would be nice to be able to get their benefits.