mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #826] markdownlint lints HTML comments when proper-names is used #2390
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#2390
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 @axilleas on GitHub (May 23, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/826
It seems there's a bug introduced between
0.27.0and0.28.0.If there's an HTML comment in a Markdown document and
proper-namesis used in the configuration, markdownlint lints the HTML comment. This should not be the case according to https://github.com/DavidAnson/markdownlint/blob/main/README.md#configurationSteps to reproduce
To reproduce, use the
markdownlint-cli2library, with the following configuration:And a Markdown file:
markdownlint-cli2@0.6.0which includes markdownlint0.27.0, no error should be thrown:markdownlint-cli2@0.7.0which includes markdownlint0.28.1, an error is thrown:@DavidAnson commented on GitHub (May 23, 2023):
I'm surprised I didn't have a test for this, but I think the new behavior is correct. If you want to ensure a document represents a proper name with the correct spelling, you probably want to do that everywhere in the document. Comments don't get rendered, but it would be strange to have inconsistent capitalization there, I think. As implemented today, the
proper-namesoption can be set tofalseto ignore comments as you propose (and like they used to be).Here's an example: https://dlaa.me/markdownlint/#%25m%23%20Issue%20826%0A%0AMarkdownlint%0A%0A%3C!--%20Markdownlint%20--%3E%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%22html_elements%22%3A%20false%2C%0A%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%22markdownlint%22%0A%20%20%20%20%5D%0A%20%20%7D%0A%7D%20--%3E%0A
PS: Before you call me out on this, I will acknowledge the same argument could be made for front matter, and I have no plans to start scanning that with any of the rules. However, that's metadata rather than part of the Markdown document, so I think it's reasonable to continue treating it separately.
@axilleas commented on GitHub (May 23, 2023):
Aha! So there's an
"html_elements": falseoption! I completely missed that 🤦 I should have read the docs better. I tested and it works indeed.😄 I would never do that 🙂
Thanks again for the quick response! I'll go ahead and close this.