MD053 - link-image-reference-definitions¶
Description¶
This rule checks for link and image reference definitions that are either unused (not referenced by any link or image) or duplicated (the same label defined multiple times).
Rationale¶
Unused reference definitions clutter the document and may indicate incomplete editing. Duplicate definitions are confusing because only the first one is used by Markdown parsers. Removing unnecessary definitions keeps the document clean and maintainable.
Configuration¶
ignored_definitions-
List of definition labels to ignore.
- Default:
["//"]
- Default:
Examples¶
Invalid¶
# Invalid Reference Links
This document has unused and duplicate reference definitions.
Here is a [used link][example].
[example]: https://example.com
[unused]: https://unused.example.com
[example]: https://duplicate.example.com
Valid¶
# Valid Reference Links
All reference definitions below are used.
This is a [full reference link][example].
This is a [collapsed reference][].
This is a [shortcut reference].
An image: ![alt text][image]
[example]: https://example.com
[collapsed reference]: https://collapsed.example.com
[shortcut reference]: https://shortcut.example.com
[image]: https://example.com/image.png
[//]: # (This is an ignored comment-style definition)