Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remark rules do not seem to account for sub-bullets #255

Closed
Zamiell opened this issue Feb 27, 2021 · 3 comments
Closed

Remark rules do not seem to account for sub-bullets #255

Zamiell opened this issue Feb 27, 2021 · 3 comments
Labels
🙋 no/question This does not need any changes 🙉 open/needs-info This needs some more info 👎 phase/no Post cannot or will not be acted on 🐛 type/bug This is a problem

Comments

@Zamiell
Copy link

Zamiell commented Feb 27, 2021

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.

@Zamiell Zamiell added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Feb 27, 2021
@wooorm
Copy link
Member

wooorm commented Feb 1, 2024

Heya, I just had some time to investigate this!

You’re using all the presets; that might not be what you want, they reconfigure rules several times, and the last configuration sticks.

However, this is a pretty bad suggestion, because when we follow the advice:

The suggestions are not all encompassing: you asked (through your presets) to warn about not enough spaces between - and text, the message says: you asked me to ask you to add 2 spaces there, add them. Some spaces in markdown have meaning, and in some cases you also then have to add spaces in other places. Such as here.

GitHub will incorrectly format that to:

This has more to do with how error messages exist because it is unclear what a human wants. Tools only know that this doesn’t match expectations, they don’t know else you meant. Every markdown character is valid. A lint rule can’t know what you think is rendering correct or incorrect

The list-item-spacing logic does not understand that this is a "tight" list, so it spuriously wants a new line.

That’s how “markdown style guide”, which you chose, works. They (you) want that.

The list-item-content-indent doesn't understand that sub-bullets exist and assumes that you made a typo.

It works as intended. You did make a “typo”. You should remove that one space.


Here’s the markdown the linter wanted:

-   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.

@wooorm wooorm closed this as completed Feb 1, 2024

This comment has been minimized.

@wooorm wooorm added the 🙋 no/question This does not need any changes label Feb 1, 2024
Copy link

github-actions bot commented Feb 1, 2024

Hi! Thanks for reaching out! Because we treat issues as our backlog, we close issues that are questions since they don’t represent a task to be completed.

See our support docs for how and where to ask questions.

Thanks,
— bb

@github-actions github-actions bot added the 👎 phase/no Post cannot or will not be acted on label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes 🙉 open/needs-info This needs some more info 👎 phase/no Post cannot or will not be acted on 🐛 type/bug This is a problem
Development

No branches or pull requests

2 participants