MD037 - no-space-in-emphasis¶
Description¶
This rule is triggered when emphasis markers (bold, italic) are used, but they have spaces between the markers and the text. For example, ** bold ** instead of **bold**. Escaped markers such as \* and \_ are literal text and are not flagged. This rule is not auto-fixable: spaced asterisks are often literal, as in 2 * 3 * 4, and removing the spaces would turn them into emphasis the author never intended.
Fixable: No
Rationale¶
Emphasis is only parsed as such when the asterisks or underscores are not surrounded by spaces. Extra spaces inside emphasis markers prevent the text from being properly rendered as bold or italic, and likely indicate the author intended to use emphasis formatting.
Examples¶
Invalid¶
# Improper Emphasis
This text has ** bold ** with spaces inside.
Here is * italic * with spaces too.
Underscores also fail: __ bold __ and _ italic _.
Valid¶
# Proper Emphasis
This text has **bold** and *italic* formatting.
You can also use __bold__ and _italic_ with underscores.
Multiple **bold words** in a sentence are *perfectly fine*.
Even ***bold and italic*** together works properly.