Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MD054 - Link and Image Style

Link and image style should be consistent.

Why This Rule Exists

Markdown supports inline and reference-style links. Consistent style throughout a document improves readability and maintainability.

Styles

Inline

[Link text](https://example.com)
![Alt text](image.png)

Reference (Full)

[Link text][ref]
![Alt text][img]

[ref]: https://example.com
[img]: image.png

Reference (Collapsed)

[Example][]

[Example]: https://example.com

Reference (Shortcut)

[Example]

[Example]: https://example.com

Examples

Incorrect (Mixed)

See [inline link](https://example.com) and [reference link][ref].

[ref]: https://other.com

Correct

See [inline link](https://example.com) and [other link](https://other.com).

Configuration

[MD054]
autolink = true           # Allow autolinks <https://example.com>
inline = true             # Allow inline style
full = true               # Allow full reference style
collapsed = true          # Allow collapsed reference style
shortcut = true           # Allow shortcut reference style
url_inline = true         # Allow inline for URLs only

When to Disable

  • Documents with intentional style mixing
  • Content where different styles serve different purposes

Rule Details

  • Rule ID: MD054
  • Aliases: link-image-style
  • Category: Links
  • Severity: Warning
  • Auto-fix: No
  • MD052 - Reference links must be defined
  • MD053 - Unused reference definitions
  • MD059 - Descriptive link text