MDS062: link-validity
Links must not use the reversed (text)[url] form, and every link
or image must have a non-empty destination; a link must also have
visible text.
This rule closes the markdownlint MD011 (no-reversed-links) and
MD042 (no-empty-links) gap. Both shapes are correctness defects —
the link silently does not work — so the rule is enabled by default.
- Reversed syntax
(text)[url]: CommonMark renders this as literal text, so the intended link is lost.mdsmith fixrewrites it to[text](url). - Empty destination
[text](),[text](<>),[text](#), or a whitespace-only target: the link goes nowhere. The same check applies to images (![alt]()). - Empty link text
[](url): the link has nothing to click. An image-only link such as[](url)is not empty — the image is its visible content.
A reversed pattern inside a code span, a code block, or a directive-generated body is left alone. An empty image destination is reported here; empty image alt text with a valid destination is MDS032’s concern, not this rule’s.
# Config
Enabled by default:
rules:
link-validity: trueDisable:
rules:
link-validity: false# Examples
# Bad – reversed link
# Reversed link
(example)[https://example.com] points the wrong way.# Bad – empty destination
# Empty target
The [docs link]() has no destination.# Bad – empty link text
# Empty text
A link with [](https://example.com) no text is broken.# Good – valid links
# Valid links
A [normal link](https://example.com) works as written.
The autolink <https://example.com> is also fine.# Good – reversed shape shown as code
# Code span
The reversed form `(text)[url]` is shown as code, not as a link.# Diagnostics
| Condition | Message |
|---|---|
reversed (text)[url] | reversed link: use [text](url) instead of (text)[url] |
| empty link destination | empty link destination |
| empty link text | empty link text |
| empty image destination | empty image destination |