mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #171] MD031 should ignore prettier-ignore comment #149
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#149
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 @plehnen on GitHub (Mar 13, 2019).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/171
Putting
<!-- prettier-ignore -->one line above some code block will cause the error MD031 - Fenced code blocks should be surrounded by blank lines.It should ignore html comments when checking for blank lines.
The prettier-ignore is needed, because otherwise prettier would format the code to one line, removing my intended formatting.
@DavidAnson commented on GitHub (Mar 13, 2019):
Can you show an example, please? This sounds kind of like a workaround for a bug in prettier. I may still implement this, but I’d like to see the scenario first. Thanks!
@plehnen commented on GitHub (Mar 13, 2019):
Sure! This is how the part of the file looks like:
> Settings > Editor > Live Templates > Vue - vcomputed <!-- prettier-ignore --> ```vue computed: { $name$() { return this.$data$ $END$; }, }, ```Removing the prettier-ignore will format the code in a way which is not desired.
Leaving it there will be warned by markdownlint.
Adding a blank line between the prettier-ignore and the block code will automatically be removed by prettier.
@DavidAnson commented on GitHub (Mar 13, 2019):
Makes sense. Any idea why prettier thinks it can reformat your code fence? It probably should never do that because it’s almost certain to change the way the content renders.
@plehnen commented on GitHub (Mar 13, 2019):
No idea, sorry. I am relatively new to the world of linters ;)
But I feel that a html comment could be placed anywhere and should just be ignored by the linter.
Especially because the comment used as a ignore rule has to be directly attached to the code it belongs to.
@DavidAnson commented on GitHub (Mar 14, 2019):
FYI: I opened https://github.com/prettier/prettier/issues/5971 to track the unexpected reformatting in the
Prettierproject. I'll use this issue to track the above suggestion formarkdownlint.