mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #190] Trailing spaces not allowed in indented code blocks #165
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @wouter-admiraal-sonarsource on GitHub (May 23, 2019).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/190
Hi,
First of all, thanks for this awesome tool 👍 !
I ran into an issue when using indented code blocks. Consider this Markdown snippet:
This is using the original, "standard" Markdown (which doesn't have fenced code blocks). In this code snippet, I have several blank lines to improve readability. This means, the snippet renders like so:
If the empty lines were to be trimmed, it would render something like this:
So, the empty lines need to be indented like the rest.
However, rule MD009 flags this is as incorrect, and fails with:
I suggest this rule be deactivated whenever we're inside a code block. Lines containing nothing but white space probably have a special meaning when in context of code. I would imagine this could be done for both indented and fenced code blocks, but I could be wrong.
Note: I actually started forking and was preparing a PR, but then I saw that you prefer an issue opened first :-). So, this is the issue. But JIC, here is a commit with a proposed fix, along with an update test. The test -- correctly -- fails if the fix is not implemented.
@DavidAnson commented on GitHub (May 23, 2019):
Thank you for the very detailed issue!
I agree with the change you propose for indented code blocks. However, I don’t see a need to change the behavior for fenced blocks. (Convince me with an example?)
Could you please create a PR with your commit? I propose the following tweaks:
ifstatement into the existing conditional two lines below (should reduce code churn)nextbranch (I need to update CONTRIBUTING, sorry)@wouter-admiraal-sonarsource commented on GitHub (May 24, 2019):
Thanks for the reply. I'm not sure for the fenced blocks. I was more thinking: "it won't hurt".
Looking through the code, I don't see any way to see in what kind of code block the current line is. This means I'd introduce some new state when looping over the lines. Is that correct?
PR #191 created.
@DavidAnson commented on GitHub (May 24, 2019):
It should be easy. I’ll add a note to the PR. Thank you!
@DavidAnson commented on GitHub (Jun 9, 2019):
Part of
0.15.0.