mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-26 01:36:03 +03:00
[GH-ISSUE #524] Feature Request: markdownlint-disable-line #427
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#427
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 @Zamiell on GitHub (May 9, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/524
Hello, and thanks for the excellent linter!
Currently, markdownlint has the
disable-next-linedirective, which is quite a handy feature!For example, the
README.mdfile gives the following example:Unfortunately, this not the greatest example, because if you have Prettier installed (which many projects do nowadays), as soon as you hit
Ctrl + sin VSCode to save the file, Prettier will automatically reformat it to the following:And now the comment will no longer apply.
This happened to me earlier today. Being familiar with ESLint, I intuitively knew how to fix the problem, so I tried this:
But unfortunately, that doesn't work, because surprisingly, markdownlint only supports
disable-next-lineand notdisable-line.Can this please be added?
@DavidAnson commented on GitHub (May 9, 2022):
You can do this with disable/restore as shown in the documentation: https://github.com/DavidAnson/markdownlint#configuration
@Zamiell commented on GitHub (May 9, 2022):
@DavidAnson Thanks for the quick response.
I see in the docs that it is possible to do disable/restore, but this is pretty cumbersome.
It also is not very DRY - programmers will have to duplicate the code on multiple lines.
It would be better UX and less maintenance for end-users if this linter could also have the
disable-linefeature, which would allow programmers to specify the directive and associated rule exactly one time.Other popular linters like ESLint and CSpell have this functionality, so I think it is reasonable for
markdownlintto have it too.@DavidAnson commented on GitHub (May 9, 2022):
In my opinion, "next line" is better than "line" because it is clear, it doesn't interfere with the content, and it doesn't risk creating too-long lines. The problem is that Prettier breaks that and needs to be worked around. It would be nice if Prettier were more respectful here, but I can look into adding "line" as an alternative.
@Zamiell commented on GitHub (May 9, 2022):
100% agree!
Agreed! But I don't think it would be practical for Prettier to hardcode an array with the names of all of the popular linters out there, and then treat comments with those keywords with special behavior. So it doesn't seem like a problem that Prettier can fix upstream either.
Thank you!
@DavidAnson commented on GitHub (May 9, 2022):
I know of just one other Markdown linting tool in the Node ecosystem. I think they could handle it if they wanted to. :)
@Zamiell commented on GitHub (May 9, 2022):
Well, what about CSpell? Surely, many people need to spell check their markdown documents. If you're not familiar with it, it has syntax like this:
So that would have to be added as well. And what if some other extension for spell checking started to get more popular than CSpell? Or some other markdown linter got more popular than markdownlint? Should that be added too? I wouldn't be surprised if there were other tools that lint markdown that I'm not personally aware of, so maybe the list could get quite long.
It seems pretty weird for Prettier to be in the business of hard-coding popular tools, as that would be a maintenance burden, especially for a hypothetical niche feature like this.
*in a<code>#2205