DavidAnson / markdownlint

A Node.js style checker and lint tool for Markdown/CommonMark files.
MIT License
4.79k stars 729 forks source link

MD030, Spaces after list markers isn’t enforced if 0 spaces #47

Open thomasjbradley opened 7 years ago

thomasjbradley commented 7 years ago

Here’s an example of incorrect Markdown:

-Some stuff
-More stuff
- Things

I would like to enforce a single space after those dashes in the list. Without the space Markdown interprets it as a paragraph.

Important configuration I have turned on:

{
  "ul-style": {
    "style": "dash"
  },
  "list-indent": true,
  "ul-start-left": true,
  "ul-indent": {
    "indent": 2
  },
  "list-marker-space": {
    "ul_single": 1,
    "ol_single": 1,
    "ul_multi": 1,
    "ol_multi": 1
  },
}

What error message I do see:

MD032 — Lists should be surrounded by blank lines.

Which doesn’t make sense to me because those aren’t separate lists. It’s interpreting the last, correct dash, as a list and the other two as paragraphs.

Use case:

I teach beginners, people who have never written a line of Markdown before. The idea that a missing space can have such an impact is foreign. I’d like to use the linter to find these simple mistakes beforehand.

Any thoughts would be appreciated. Thanks.

DavidAnson commented 7 years ago

The specification is clear about the need for spaces after list markers: http://spec.commonmark.org/0.27/#list-items

So the output you're getting is technically correct. That said, I agree it's not the most helpful for this scenario. I'll think about how to modify the rule to make things more clear. Thank you!

thomasjbradley commented 7 years ago

Thanks for your response.

I just read the spec—and yes it does definitely require as space as you say. And yeah, you’re right that the error message is “technically” correct—but not terribly helpful.

Though it’s explained to my students that a space is required after a list marker only about half actually add it. It’d be great to come up with a helpful solution.

Just some thoughts here:

Thanks for your help.

DavidAnson commented 7 years ago

I think I can do something useful here. :) Let me finish working on a different issue then I will look into this some more.

thomasjbradley commented 7 years ago

Awesome, thanks.

DavidAnson commented 7 years ago

When people make this mistake, do they tend to forget just some of the spaces or all of them?

thomasjbradley commented 7 years ago

It’s almost always all of the spaces.

DavidAnson commented 7 years ago

This seems like it will be more of a heuristic than an absolute - I'm going to make it a new rule so it can be disabled independently of MD030. I have an implementation in mind, but it may not make the cut for the upcoming release.

thomasjbradley commented 7 years ago

Okay—thanks so much for looking into it.