remarkjs / remark-lint

plugins to check (lint) markdown code style
https://remark.js.org
MIT License
938 stars 129 forks source link

Tab indented list item causes `list-item-spacing` error for all list items #78

Closed sindresorhus closed 8 years ago

sindresorhus commented 8 years ago

Fixture

# Foo

- [Java](https://github.com/akullpp/awesome-java)
    - [RxJava](https://github.com/eleventigers/awesome-rxjava)
- [Kotlin](https://github.com/KotlinBy/awesome-kotlin)
- [OCaml](https://github.com/rizo/awesome-ocaml)
- [ColdFusion](https://github.com/seancoyne/awesome-coldfusion)
- [Fortran](https://github.com/rabbiabram/awesome-fortran)
- [.NET](https://github.com/quozd/awesome-dotnet)
- [PHP](https://github.com/ziadoz/awesome-php)
- [Delphi](https://github.com/Fr0sT-Brutal/awesome-delphi)
- [Assembler](https://github.com/brainblowjob/awesome-asm)
- [AutoHotkey](https://github.com/ahkscript/awesome-AutoHotkey)
- [AutoIt](https://github.com/J2TeaM/awesome-AutoIt)
- [Crystal](https://github.com/veelenga/awesome-crystal)
- [TypeScript](https://github.com/dzharii/awesome-typescript)

Result

   4:60-5:1   error    Missing new line after list item              list-item-spacing
   5:55-6:1   error    Missing new line after list item              list-item-spacing
   6:49-7:1   error    Missing new line after list item              list-item-spacing
   7:64-8:1   error    Missing new line after list item              list-item-spacing
   8:59-9:1   error    Missing new line after list item              list-item-spacing
  9:50-10:1   error    Missing new line after list item              list-item-spacing
  10:47-11:1  error    Missing new line after list item              list-item-spacing
  11:59-12:1  error    Missing new line after list item              list-item-spacing
  12:59-13:1  error    Missing new line after list item              list-item-spacing
  13:64-14:1  error    Missing new line after list item              list-item-spacing
  14:53-15:1  error    Missing new line after list item              list-item-spacing
  15:57-16:1  error    Missing new line after list item              list-item-spacing

No errors when the RxJava item is removed.

wooorm commented 8 years ago

Yup, that’s by design, you can turn it off though (in fact, that’s what I’m often doing!)

sindresorhus commented 8 years ago

An indented list item is not an empty line though. It's still part of the list.

wooorm commented 8 years ago

This rule switches based on whether there are list-items with more than one lines (not necessarily blank or empty lines), or not.

Or are you saying that the second list-item is part of the upper list (and not a new, nested list)? In that case, I don’t believe so (the second is preceded by a\t):

- [Java](https://github.com/akullpp/awesome-java)
    - [RxJava](https://github.com/eleventigers/awesome-rxjava)
- [Kotlin](https://github.com/KotlinBy/awesome-kotlin)
    - [RxJava](https://github.com/eleventigers/awesome-rxjava)
- [OCaml](https://github.com/rizo/awesome-ocaml)

Yields:

sindresorhus commented 8 years ago

you can turn it off though (in fact, that’s what I’m often doing!)

Shouldn't that be a sign that the rule is broken.

sindresorhus commented 8 years ago

I'm saying that it makes no sense not to allow:

- [Java](https://github.com/akullpp/awesome-java)
    - [RxJava](https://github.com/eleventigers/awesome-rxjava)
- [OCaml](https://github.com/rizo/awesome-ocaml)

The rule, from its description, is meant to prevent cases like:

- [Java](https://github.com/akullpp/awesome-java)

- [RxJava](https://github.com/eleventigers/awesome-rxjava)

- [OCaml](https://github.com/rizo/awesome-ocaml)
wooorm commented 8 years ago

Pff, we’re talking about style here! It’s personal!

in fact, that’s what I’m often doing!

...is because I changed my preferences. I really like the rule for readability in markdown, but I don’t like how the extra lines render to HTML, such as on GH.

The rule, from its description, is meant to prevent cases like

I’m open to changing the description, let me know if you have suggestions!

sindresorhus commented 8 years ago

I get it's about style, but the rule is being very inconsistent...

What's the correct way to do an indented list item then?

wooorm commented 8 years ago

I feel the confusion for this will pass once GH-81 lands, so I’m deferring talk (if still required) to that place!

According the markdown-style-guide, any list-item which spans more than one line, taints the whole list, and requires it to have a blank line between each item.

sindresorhus commented 8 years ago

I feel the confusion for this will pass once GH-81 lands

I don't see how that is related at all. I explicitly turned this rule on and got confused by its unintuitive behavior.

According the markdown-style-guide, any list-item which spans more than one line, taints the whole list, and requires it to have a blank line between each item.

Sometimes it's better to be intuitive than "correct". But doesn't matter, I'll just fork the rules I don't agree with.

wooorm commented 8 years ago

You’re right, I added a better description!

wooorm commented 8 years ago

But doesn't matter, I'll just fork the rules I don't agree with.

I’d be glad to maintain take care of the non-awesome-related ones in this project 👍

sindresorhus commented 8 years ago

Sure, will do a PR at some point, but I don't have time for doing those rules right now.

Kristinita commented 5 years ago

@woorm, I opened the issue in official markdown-style-guide repository. New lines after list items not needed for sindresorhus example.

Thanks.