markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

MD037 Flags asterisks in HTML attributes

Open mtlynch opened this issue 3 years ago • 2 comments

First, thanks for all your excellent work on markdownlint! I ran into a minor bug today that I wanted to share.

If there are two asterisks in an HTML attribute, markdownlint will flag it as MD037/no-space-in-emphasis. This seems to be an error as there isn't markdown within HTML attributes:

Example input

<img src="cron.png" alt="cron job with a '0 0 3 * *' schedule">

markdown-lint output

$ davidanson/markdownlint-cli2 example.md
markdownlint-cli2 v0.5.0 (markdownlint v0.26.1)
Finding: example.md
Linting: 1 file(s)
Summary: 2 error(s)
example.md:1:49 MD037/no-space-in-emphasis Spaces inside emphasis markers [Context: "* *"]
example.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "<img src="cron.png" alt="cron ..."]

mtlynch avatar Jul 29 '22 13:07 mtlynch

Thanks for the clear reproduction! There are a number of rules that use heuristics instead of the parser and so don't really understand the context of what they are reporting. I already have a helper that excludes violations like this from code spans; I should be able to do something similar for HTML.

DavidAnson avatar Jul 29 '22 16:07 DavidAnson

Oh, and thanks for the sponsorship!!

DavidAnson avatar Jul 29 '22 16:07 DavidAnson