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

Trailing whitespace that could produce a hard break but won't due to context should also be flagged by MD009 #216

Closed
TheJaredWilcurt opened this issue Aug 25, 2019 · 4 comments

Comments

@TheJaredWilcurt
Copy link

TheJaredWilcurt commented Aug 25, 2019

* Example
  * The next line has 2 spaces
  
  * The line above this should be flagged for trailing whitespace

There are two spaces on the 3rd line that should be flagged as trailing whitespace.
Here are the rules I'm using, in case I have something set wrong:

Here it is again, but with the spaces replaced by hearts to make it easier to see

*♥asdf
♥♥*♥zxcv
♥♥
♥♥*♥qwer
@DavidAnson
Copy link
Owner

Exactly 2 trailing spaces has a special meaning in Markdown. If you change your example to just one space or three+, MD009 will fire as expected. You can use the br_spaces perimeter to report issues for two spaces as well. More detail is available in the documentation here: https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009---trailing-spaces

@TheJaredWilcurt
Copy link
Author

TheJaredWilcurt commented Aug 26, 2019

I understand the 2 spaces being a <br>, but that should only be at the end of a line with content.

In this context, it is obvious that it is an indentation placed by the editor and would not be interpreted to produce a <br>. It is continuing the indentation of the previous line.

* Example
  * two space indent
    * four spaces
    
    * The above line also has 4 spaces

When it's an empty line, with nothing but spaces, in the middle of a list, it should let you auto-flag that.

@DavidAnson
Copy link
Owner

Using the br_spaces parameter I reference above should report for your original example.

MD009 could also be enhanced to understand scenarios where trailing spaces do not insert a hard break and report on that in the default configuration. Is that what you are looking for?

Context: https://spec.commonmark.org/0.29/#hard-line-breaks

@TheJaredWilcurt
Copy link
Author

Yes, that is what I want. I'd like it to flag where trailing spaces are used but do not produce a <br>.

@DavidAnson DavidAnson changed the title Trailing whitespace not caught in unordered list empty line Trailing whitespace that could produce a hard break but won't due to context should also be flagged by MD009 Aug 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants