[GH-ISSUE #450] File containing markdownlint-disable-file still runs rules #2218

Closed
opened 2026-03-07 20:05:41 +03:00 by kerem · 1 comment
Owner

Originally created by @pxl9588 on GitHub (Oct 25, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/450

I have a custom rule set with the tag 'readmeValidator', one of the rules throws an error on line 5. Using the README.md below I get an exception because line 5 does not exist.

# Test

<!-- markdownlint-disable-file readmeValidator -->

I expected this file to be ignored completely by rules tagged with readmeValidator but that isn't the case.

Originally created by @pxl9588 on GitHub (Oct 25, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/450 I have a custom rule set with the tag 'readmeValidator', one of the rules throws an error on line 5. Using the README.md below I get an exception because line 5 does not exist. ```markdown # Test <!-- markdownlint-disable-file readmeValidator --> ``` I expected this file to be ignored completely by rules tagged with readmeValidator but that isn't the case.
kerem 2026-03-07 20:05:41 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Oct 25, 2021):

Yes, disabled rules run when present - it's the output that's disabled. In this particular case, that's not strictly necessary, but in general disabling a rule for part of a file still requires running that rule on the rest of the file. For simplicity and consistency, configured rules run on all input and their output is filtered according to inline comments like this one.

What you probably want to do is fix that rule so it works rather than trying to disable it everywhere it breaks.

<!-- gh-comment-id:951286427 --> @DavidAnson commented on GitHub (Oct 25, 2021): Yes, disabled rules run when present - it's the output that's disabled. In this particular case, that's not strictly necessary, but in general disabling a rule for part of a file still requires running that rule on the rest of the file. For simplicity and consistency, configured rules run on all input and their output is filtered according to inline comments like this one. What you probably want to do is fix that rule so it works rather than trying to disable it everywhere it breaks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2218
No description provided.