Skip to content

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)

![Company logo](logo.png)

[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 )

![Company logo]( logo.png )

Fixed

Spaces removed from inside parentheses:

[Visit our website](https://example.com)

[Visit our website](https://example.com)

[Visit our website](https://example.com)

![Company logo](logo.png)

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 tabs and other whitespace characters

Learn more