Skip to content

MD054 - link-image-style

Description

This rule checks that links and images in Markdown follow a consistent style. Links and images can use inline syntax, reference syntax (full, collapsed, or shortcut), or autolink syntax. The rule can be configured to allow or disallow specific styles.

Rationale

Consistent formatting makes it easier to understand a document. Autolinks are concise but appear as raw URLs. Inline links include descriptive text but take more space. Reference links are easier to read in Markdown source but require separate definitions.

Configuration

autolink

Allow autolinks (e.g., <https://example.com>).

  • Default: true
inline

Allow inline links and images.

  • Default: true
full

Allow full reference links and images (e.g., [text][ref]).

  • Default: true
collapsed

Allow collapsed reference links and images (e.g., [ref][]).

  • Default: true
shortcut

Allow shortcut reference links and images (e.g., [ref]).

  • Default: true
url_inline

Allow URLs as inline links (e.g., [https://...](https://...)).

  • Default: true

Examples

Invalid

# Invalid Link Style

<https://example.com>

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

Valid

# Valid Link Styles

This document uses inline links [like this](https://example.com).

Here is an ![inline image](https://example.com/image.png).

Reference links [like this][ref] are also used.

[ref]: https://example.com