[GH-ISSUE #832] Latest version seems to lint into multiline HTML comments despite html_elements: false #544

Closed
opened 2026-03-03 01:27:53 +03:00 by kerem · 9 comments
Owner

Originally created by @Ravlen on GitHub (May 25, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/832

As the title says, we tried rolling out the latest version and noticed that this version is linting into multi-line HTML comments, ignoring our html_elements: false setting, at least for rule MD044.

This doesn't work:

  • Screenshot 2023-05-25 at 20 03 33

This gets ignored as expected:

  • Screenshot 2023-05-25 at 20 04 03

It looks like it only works if the line either starts with <!-- or ends with -->:

  • Screenshot 2023-05-25 at 20 05 02
Originally created by @Ravlen on GitHub (May 25, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/832 As the title says, we tried rolling out the latest version and noticed that this version is linting into multi-line HTML comments, ignoring our `html_elements: false` setting, at least for rule MD044. This doesn't work: - ![Screenshot 2023-05-25 at 20 03 33](https://github.com/DavidAnson/markdownlint/assets/36979740/6b5c0564-26c9-43a6-b5e6-f313a9f0d1bf) This gets ignored as expected: - ![Screenshot 2023-05-25 at 20 04 03](https://github.com/DavidAnson/markdownlint/assets/36979740/4ab14bd6-b5e6-47ed-860e-c8d1fc5bc96f) It looks like it only works if the line either starts with `<!--` or ends with `-->`: - ![Screenshot 2023-05-25 at 20 05 02](https://github.com/DavidAnson/markdownlint/assets/36979740/c7fbc073-3af3-4093-842c-8663988e95da)
kerem 2026-03-03 01:27:53 +03:00
Author
Owner

@okalachev commented on GitHub (May 28, 2023):

Also having a problem with this parameter.

Works for single line HTML, but doesn't work for multi-line:

Screenshot 2023-05-28 at 14 45 29

Version 0.34.0.

<!-- gh-comment-id:1566108168 --> @okalachev commented on GitHub (May 28, 2023): Also having a problem with this parameter. Works for single line HTML, but doesn't work for multi-line: <img width="344" alt="Screenshot 2023-05-28 at 14 45 29" src="https://github.com/DavidAnson/markdownlint/assets/1683279/18f25b89-0710-4421-8a0f-3c4f05fe3443"> Version 0.34.0.
Author
Owner
<!-- gh-comment-id:1566418121 --> @DavidAnson commented on GitHub (May 29, 2023): @okalachev, OCR and attempting to reproduce your own example gives me two issues, not one. What am I missing? https://dlaa.me/markdownlint/#%25m%23%20Issue%20832%0A%0A%3Ca%20href%3D%22https%3A%2F%2Fexample.org%22%3E%0A%3Cdiv%3E%3Ca%20href%3D%22https%3A%2F%2Fexample.org%22%3E%3C%2Fdiv%3E%0A%3Cdiv%3E%0A%20%20%3Ca%20href%3D%22https%3A%2F%2Fexample.org%22%3E%0A%3C%2Fdiv%3E%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%22MD033%22%3A%20false%2C%0A%20%20%22MD044%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%22HTTPS%22%0A%20%20%20%20%5D%0A%20%20%7D%0A%7D%20--%3E%0A
Author
Owner
<!-- gh-comment-id:1566445052 --> @okalachev commented on GitHub (May 29, 2023): @DavidAnson, sorry for using an image instead of text, but I wanted to emphasize the detected error. Here is what I'm showing: https://dlaa.me/markdownlint/#%25m%23%20Issue%20832%0A%0A%3Ca%20href%3D%22https%3A%2F%2Fexample.org%22%3E%0A%0A%3Cdiv%3E%3Ca%20href%3D%22https%3A%2F%2Fexample.org%22%3E%3C%2Fdiv%3E%0A%0A%3Cdiv%3E%0A%20%20%3Ca%20href%3D%22https%3A%2F%2Fexample.org%22%3E%0A%3C%2Fdiv%3E%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%22MD033%22%3A%20false%2C%0A%20%20%22MD044%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%22HTTPS%22%0A%20%20%20%20%5D%0A%20%20%7D%0A%7D%20--%3E%0A. Two single-line HTMLs (OK), one multiline (not OK).
Author
Owner

@DavidAnson commented on GitHub (May 29, 2023):

Your example shows the same behavior as mine. This difference is probably not important since the fix for both scenarios is probably the same. I'll have a look soon.

<!-- gh-comment-id:1566507879 --> @DavidAnson commented on GitHub (May 29, 2023): Your example shows the same behavior as mine. This difference is probably not important since the fix for both scenarios is probably the same. I'll have a look soon.
Author
Owner

@DavidAnson commented on GitHub (May 29, 2023):

(Aha, the difference in samples is whether there are blank lines above/below the middle line.)

<!-- gh-comment-id:1566530882 --> @DavidAnson commented on GitHub (May 29, 2023): (Aha, the difference in samples is whether there are blank lines above/below the middle line.)
Author
Owner

@DavidAnson commented on GitHub (May 29, 2023):

Where we're at:
@Ravlen, your issue is fixed by the commit above.
@okalachev, your issue has turned up other issues... :)

<!-- gh-comment-id:1566576900 --> @DavidAnson commented on GitHub (May 29, 2023): Where we're at: @Ravlen, your issue is fixed by the commit above. @okalachev, your issue has turned up other issues... :)
Author
Owner

@Ravlen commented on GitHub (May 29, 2023):

@DavidAnson As always, you do wonderful work! I'd love to make the PRs to fix these myself, but I'm only smart enough to use your great tool, not help out with it 😅

<!-- gh-comment-id:1566578240 --> @Ravlen commented on GitHub (May 29, 2023): @DavidAnson As always, you do wonderful work! I'd love to make the PRs to fix these myself, but I'm only smart enough to use your great tool, not help out with it 😅
Author
Owner

@DavidAnson commented on GitHub (May 29, 2023):

@Ravlen :) Thanks! I try to make the rules as simple as possible, but some of them are almost absurdly tricky. Maybe if I were smarter, some of this would be more approachable!

<!-- gh-comment-id:1566581533 --> @DavidAnson commented on GitHub (May 29, 2023): @Ravlen :) Thanks! I try to make the rules as simple as possible, but some of them are almost absurdly tricky. Maybe if I were smarter, some of this would be more approachable!
Author
Owner

@okalachev commented on GitHub (May 29, 2023):

Agreed about wonderful work, thanks to this tool we can keep the source code of our big documentation site clean and consistent.

But due to these MD044 issues with HTML I can't switch do the latest version unfortunately.

<!-- gh-comment-id:1566594834 --> @okalachev commented on GitHub (May 29, 2023): Agreed about wonderful work, thanks to this tool we can keep the source code of our big documentation site clean and consistent. But due to these MD044 issues with HTML I can't switch do the latest version unfortunately.
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#544
No description provided.