Skip to content

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**.

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.