MD062 - No whitespace in link destinations¶
Aliases: link-destination-whitespace, no-space-in-link-destination
What this rule does¶
Removes unnecessary whitespace inside parentheses for link and image destinations.
Why this matters¶
- Copy-paste errors: Extra spaces often appear from copying URLs with leading/trailing whitespace
- Clean formatting: Link destinations should be tightly wrapped
- Consistent style: Matches common markdown conventions
- Prevents issues: Some parsers may handle whitespace inconsistently
Examples¶
Correct¶
Link destinations directly touch the parentheses:
[Visit our website](https://example.com)

[Link with title](https://example.com "Title text")
Incorrect¶
Extra spaces inside parentheses around the URL:
[Visit our website]( https://example.com)
[Visit our website](https://example.com )
[Visit our website]( https://example.com )

Fixed¶
Spaces removed from inside parentheses:
[Visit our website](https://example.com)
[Visit our website](https://example.com)
[Visit our website](https://example.com)

Configuration¶
This rule has no configuration options.
Automatic fixes¶
This rule will:
- Remove spaces after opening parenthesis
( - Remove spaces before closing parenthesis
) - Work on both regular links and images
- Preserve link titles (e.g.,
"title text") - Handle spaces, tabs and line endings
Only those characters are whitespace in a link destination. U+00A0 and the other Unicode spaces are part of the destination, so they are neither reported nor removed.
A destination that spans lines is joined onto one line. Inside a blockquote the > markers of the continuation lines are dropped with the line breaks, so > [k]( followed by > ) becomes > [k](). A link whose title still spans lines after the fix is left alone, because the markers could not be put back.
Learn more¶
Related rules¶
- MD039 - No space in links - Remove spaces inside link text brackets
- MD034 - No bare URLs - Ensure URLs are properly formatted as links
- MD042 - No empty links - Ensure links have destinations