mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 01:05:55 +03:00
[GH-ISSUE #5] Add ability to disable specific rule(s) for specific file(s) #2
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#2
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 @IanVS on GitHub (Aug 28, 2015).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/5
Hello, I'm working on the ESLint project, which uses this module. In general, we want to prohibit tabs in our markdown (using rule MD010), but there is one file where I need to use tabs in an example of the
indentrule. Is there a way to turn off just that rule, for just that file? If not, is that a feature you would consider adding?@DavidAnson commented on GitHub (Aug 28, 2015):
This is basically mivok/markdownlint#16, I believe. I left a comment there a while back about how I'd probably approach this - though I'd very much prefer that both implementations agree on a strategy. I'll try to get to this soon-ish. In the meanwhile, I'm already a submitter for ESLint - if you'd like to turn off MD010 globally, I can offer to turn it back on once this feature is available AND fix any unwanted violations that crept in along the way. Does that work in the short term?
@IanVS commented on GitHub (Aug 28, 2015):
Yep, that would do the trick. I have a temporary hack in place now that should get us through until something like this can be implemented.
As for the issue you linked to, I'm personally 👍 for:
but 👎 for:
...as it would preferably be able to handle a range of lines (or the entire file), maybe with a concept similar to
/*eslint-disable*/and/*eslint-enable*/.@mivok commented on GitHub (Aug 28, 2015):
I'll defer to however you want to implement it (presumably html comments at this point). Sadly, I haven't had much time to work on the ruby version lately.
mivok/markdownlint#16 was initially intended to be a rule exception for a specific line rather than disabling a rule for the whole file, but the ability to disable a rule entirely makes a lot of sense.
My rationale for putting something on the same line was for a quick simple exception for a specific occurrence of a rule violation where you didn't have to specify a line number. Something like
## Hello world <!-- ignore:MD002 -->. The intent here is for it to be an option to put it on the same line and exclude any line number information rather than for it to be a requirement to do so.@IanVS commented on GitHub (Aug 28, 2015):
Hi, I completely get the reasoning behind disabling for a single line. ESLint has this concept as well. In fact, ESLint gives a lot of flexibility to configure rules:
I don't know how feasible these are for your projects, but they certainly all come in handy for JavaScript linting.
@DavidAnson commented on GitHub (Sep 27, 2015):
See here for how to use the new functionality: https://github.com/DavidAnson/markdownlint#configuration
I believe this implementation addresses most of the scenarios @IanVS outlined with the exception of a single comment to disable a rule for a single line only. I know how I would implement that, but didn't want to complicate the initial implementation because it's just a shorthand convenience.
@DavidAnson commented on GitHub (Sep 27, 2015):
I've submitted a PR for eslint to upgrade to markdownlint 0.0.8 which contains the functionality above:
https://github.com/eslint/eslint/pull/3953
@IanVS commented on GitHub (Sep 29, 2015):
👍 Thanks! I will test this out in the next few days.