Rule - MD039#
| Property | Value |
|---|---|
| Aliases | md039, no-space-in-links |
| Autofix Available | Yes |
| Enabled By Default | Yes |
Summary#
Spaces inside link text.
Reasoning#
Readability/Correctness#
When creating a document or reading that same document, it is easy to confuse
the link labels [ label ], [label ], [ label] with the link label
[label]. Being consistent with allowing leading spaces and trailing spaces
for a link label addresses this specific issue.
Examples#
Failure Scenarios#
This rule triggers when the link label for any link or image includes leading whitespace or trailing whitespace. This is true for all four forms of links and for all four forms of images, as well as their associated link reference definitions.
Markdown
this is not
[ a proper](https://www.example.com)
link
Correct Scenarios#
This rule does not trigger if the link label for any link or image does not start with leading whitespace or end with trailing whitespace. This is true for all four forms of links and for all four forms of images.
Markdown
this is
[a proper](https://www.example.com)
link
Fix Description#
The auto-fix feature for this rule is scheduled to be added soon after the v1.0.0 release.
Configuration#
| Prefixes |
|---|
plugins.md039. |
plugins.no-space-in-links. |
| Value Name | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
True |
Whether the Rule Plugin is enabled. |
Origination of Rule#
This rule is largely inspired by the MarkdownLint rule MD039.
Differences From MarkdownLint Rule#
The difference between this rule and the original rule is that the original rule only fired on links, not image links or link definitions. As the only difference between a link:
Markdown
[a link](https://www.example.com)
and an image:
Markdown

is the ! character, it made sense for the implementation to respect both elements.