[GH-ISSUE #64] Should ignore rules inside a comment block #1902

Closed
opened 2026-03-07 20:02:35 +03:00 by kerem · 4 comments
Owner

Originally created by @CxRes on GitHub (Jul 5, 2017).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/64

Comments should be free from md rules! Or there should be an option to not check...

Originally created by @CxRes on GitHub (Jul 5, 2017). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/64 Comments should be free from md rules! Or there should be an option to not check...
kerem 2026-03-07 20:02:35 +03:00
Author
Owner

@DavidAnson commented on GitHub (Jul 5, 2017):

I think you are asking for text inside HTML comments in a Markdown file to be ignored? Is it a particular set of rules you'd like to exclude, or all of them? What is your scenario?

<!-- gh-comment-id:313251728 --> @DavidAnson commented on GitHub (Jul 5, 2017): I think you are asking for text inside HTML comments in a Markdown file to be ignored? Is it a particular set of rules you'd like to exclude, or all of them? What is your scenario?
Author
Owner

@CxRes commented on GitHub (Jul 6, 2017):

@DavidAnson Exactly...

So, I am writing a comment block something like this:

<!-- Copyright....
  -
  -  license 
-->

And the linter does not like this formatting one bit because it thinks that the lines inside are items and hence incorrectly formatted.

I would have presumed (correct me if I am wrong) that markup rules should be irrelevant inside comment blocks, in general, well because, you might want to put arbitrary information inside them???

<!-- gh-comment-id:313317828 --> @CxRes commented on GitHub (Jul 6, 2017): @DavidAnson Exactly... So, I am writing a comment block something like this: ``` <!-- Copyright.... - - license --> ``` And the linter does not like this formatting one bit because it thinks that the lines inside are items and hence incorrectly formatted. I would have presumed (correct me if I am wrong) that markup rules should be irrelevant inside comment blocks, in general, well because, you might want to put arbitrary information inside them???
Author
Owner

@DavidAnson commented on GitHub (Jul 6, 2017):

Markdown did not originally support comments, though it is used often enough with HTML that HTML comments are usually allowed. Some linting rules (ex: hard-tabs, proper-names) seem to apply just as well within a comment as without. So my thought is to leave the default behavior as it is now and add a global Boolean option to ignore HTML comments as you suggest above.

<!-- gh-comment-id:313446801 --> @DavidAnson commented on GitHub (Jul 6, 2017): Markdown did not originally support comments, though it is used often enough with HTML that HTML comments are usually allowed. Some linting rules (ex: hard-tabs, proper-names) seem to apply just as well within a comment as without. So my thought is to leave the default behavior as it is now and add a global Boolean option to ignore HTML comments as you suggest above.
Author
Owner

@CxRes commented on GitHub (Jul 7, 2017):

Sounds good!!!

I can see the slippery slope here. Since markdown is a superset of HTML, you'll have to disable rules inside all HTML tags used in the md, which may not be desirable.

<!-- gh-comment-id:313724315 --> @CxRes commented on GitHub (Jul 7, 2017): Sounds good!!! I can see the slippery slope here. Since markdown is a superset of HTML, you'll have to disable rules inside all HTML tags used in the md, which may not be desirable.
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#1902
No description provided.