MD052 - Reference Links and Images
Reference links and images should use a label that is defined.
Why This Rule Exists
Reference-style links like [text][label] must have a corresponding definition.
Undefined references render as plain text instead of links.
Examples
Incorrect
Check out the [documentation][docs] for more info.
Visit [our website][site].
<!-- Missing definitions for 'docs' and 'site' -->
Correct
Check out the [documentation][docs] for more info.
Visit [our website][site].
[docs]: https://docs.example.com
[site]: https://example.com
Images
![Logo][logo]
[logo]: ./images/logo.png "Company Logo"
Configuration
This rule has no configuration options.
When to Disable
- Documents where references are defined in included files
- Templates with programmatically injected definitions
Rule Details
- Rule ID: MD052
- Aliases: reference-links-images
- Category: Links
- Severity: Warning
- Auto-fix: No
Reference Link Syntax
<!-- Full reference -->
[Link text][label]
<!-- Collapsed reference (label matches text) -->
[Example][]
<!-- Shortcut reference -->
[Example]
<!-- Definition -->
[label]: url "Optional Title"