markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

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

Open thomasjbradley opened this issue 8 years ago • 8 comments

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.

thomasjbradley avatar Feb 17 '17 00:02 thomasjbradley

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!

DavidAnson avatar Feb 17 '17 05:02 DavidAnson

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:

  • What’s the benefit of allowing paragraphs to start a line with a dash when the dash is specifically defined as the only list marker? I can’t think of any reason when I would start a paragraph with a dash in Markdown and not expect it to become a list.
  • Maybe I should add a custom post linter to my own code that somehow enforces spaces after dashes.

Thanks for your help.

thomasjbradley avatar Feb 17 '17 14:02 thomasjbradley

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

DavidAnson avatar Feb 17 '17 16:02 DavidAnson

Awesome, thanks.

thomasjbradley avatar Feb 17 '17 16:02 thomasjbradley

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

DavidAnson avatar Feb 18 '17 02:02 DavidAnson

It’s almost always all of the spaces.

thomasjbradley avatar Feb 18 '17 15:02 thomasjbradley

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.

DavidAnson avatar Feb 21 '17 01:02 DavidAnson

Okay—thanks so much for looking into it.

thomasjbradley avatar Feb 21 '17 20:02 thomasjbradley