-
-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MD037/no-space-in-emphasis reported when underscore contained within emphasis #324
Comments
This renders correctly because the parser makes assumptions about whitespace that allow it to ignore the embedded underscore. However, the linting rule cannot do that because it is specifically looking for mistakes in that area. Therefore, this is expected behavior for the rule. It believes the underscores match in pairs and therefore sees a problem. In order to fix this, you can escape the embedded underscore with a backslash. Here's an example of your text not reporting any violations:  https://dlaa.me/markdownlint/#%25m%23%20Issue%20324%0A%0A_~%2F.ssh%2Fid%5C_rsa_%20and%20_foo_%0A |
Thanks for the quick response! It looks like the commonmark spec allows for underscores inside emphasis, so the parser is happy.
|
How do you feel about using asterisk for emphasis for that part? Doing so allows the underscore to be an escaped like so: https://dlaa.me/markdownlint/#%25m%23%20Issue%20324%0A%0A*~%2F.ssh%2Fid_rsa*%20and%20_foo_%0A |
I prefer asterisk actually, but when I run prettier it converts asterisks to underscores (and causes the MD037 report) 🤕 |
I've lost track, is Prettier helping us or hurting us? 😐 |
99% of the time it's great. It will resolve a lot of issues identified by markdownlint (things like bare URLs, or trailing punctuation in headings, it can't fix automatically). For this edge case tho, markdownlint and prettier work against each other. |
I don't see a simple way for this rule to be flexible enough to detect issues and also strict enough to allow this case. Because there are two easy workarounds (escape the underscore or use asterisks), I'm going to close the issue. |
The following markdown snippet, reports MD037/no-space-in-emphasis
Renders as:
~/.ssh/id_rsa and foo
The text was updated successfully, but these errors were encountered: