[GH-ISSUE #427] MD037 false positives with * in a <code> #356

Closed
opened 2026-03-03 01:26:00 +03:00 by kerem · 3 comments
Owner

Originally created by @regseb on GitHub (Sep 12, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/427

The no-space-in-emphasis rule (MD037) displays false positives with * in a <code> tag. There is no problem with `. Maybe the text in <code> isn't interpreted as inCode.

- <code>* *</code> (false positive);
- `* *`.
  • * * (false positive);
  • * *.
Originally created by @regseb on GitHub (Sep 12, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/427 The [_no-space-in-emphasis_](https://github.com/DavidAnson/markdownlint/blob/main/lib/md037.js) rule (_MD037_) displays false positives with `*` in a `<code>` tag. There is no problem with `` ` ``. Maybe the text in `<code>` isn't interpreted as _inCode_. ```markdown - <code>* *</code> (false positive); - `* *`. ``` > - <code>* *</code> (false positive); > - `* *`.
kerem 2026-03-03 01:26:00 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Sep 12, 2021):

MD037 only recognizes Markdown code sections using backtick or indent. HTML tags are discouraged (MD033) and ignored by this rule.

<!-- gh-comment-id:917661688 --> @DavidAnson commented on GitHub (Sep 12, 2021): MD037 only recognizes Markdown code sections using backtick or indent. HTML tags are discouraged (MD033) and ignored by this rule.
Author
Owner

@regseb commented on GitHub (Sep 12, 2021):

I have a big table in my README. I use the <table> tag to format the code (with line breaks for example). But markdown isn't interpreted in the <table> tag, so I use HTML tags (<code>, <a>...).

| Table with markdown |
| -- |
| Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br />`* *` (backtick)<br /><code>* *</code> (HTML) |

<table>
  <tr>
    <th>Table with HTML</th>
  </tr>
  <tr>
    <td>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
        dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
        ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
        eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
        deserunt mollit anim id est laborum.
      </p>
      <p>`* *` (backtick)</p>
      <p><code>* *</code> (HTML)</p>
    </td>
  </tr>
</table>
Table with markdown
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
* * (backtick)
* * (HTML)
Table with HTML

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

`* *` (backtick)

* * (HTML)

<!-- gh-comment-id:917667609 --> @regseb commented on GitHub (Sep 12, 2021): I have a big table in my [_README_](https://github.com/regseb/gout/blob/87b888f8cc383db5a28c360bbe4505834b45dbec/src/module/list/README.md). I use the `<table>` tag to format the code (with line breaks for example). But markdown isn't interpreted in the `<table>` tag, so I use HTML tags (`<code>`, `<a>`...). ```markdown | Table with markdown | | -- | | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br />`* *` (backtick)<br /><code>* *</code> (HTML) | <table> <tr> <th>Table with HTML</th> </tr> <tr> <td> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> <p>`* *` (backtick)</p> <p><code>* *</code> (HTML)</p> </td> </tr> </table> ``` > | Table with markdown | > | -- | > | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br />`* *` (backtick)<br /><code>* *</code> (HTML) | > > <table> > <tr> > <th>Table with HTML</th> > </tr> > <tr> > <td> > <p> > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et > dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip > ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore > eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia > deserunt mollit anim id est laborum. > </p> > <p>`* *` (backtick)</p> > <p><code>* *</code> (HTML)</p> > </td> > </tr> > </table>
Author
Owner

@DavidAnson commented on GitHub (Sep 12, 2021):

I understand what you are doing here, but I am reluctant to add support for HTML tags to the various Markdown rules that have corresponding HTML syntax. By rough approximation it looks like maybe half of the current rules could be applied to HTML as well. It's challenging enough to implement flexible Markdown parsing; doing the same for HTML may be too much. (It's true that I made an exception for MD041, but that was for a very common scenario that's well constrained.)

<!-- gh-comment-id:917672016 --> @DavidAnson commented on GitHub (Sep 12, 2021): I understand what you are doing here, but I am reluctant to add support for HTML tags to the various Markdown rules that have corresponding HTML syntax. By rough approximation it looks like maybe half of the current rules could be applied to HTML as well. It's challenging enough to implement flexible Markdown parsing; doing the same for HTML may be too much. (It's true that I made an exception for MD041, but that was for a very common scenario that's well constrained.)
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#356
No description provided.