# MD054 - Link Style

## Description

This rule enforces a consistent style for Markdown links. Markdown supports several different link styles, and this rule helps maintain consistency throughout a document.

## Configuration

This rule has the following configuration options:

- `style`: The style of links to enforce. Can be one of:
  - `"consistent"`: Enforce the first link style used in the document (default)
  - `"specified"`: Enforce the styles specified in the `styles` array

- `styles`: An array of allowed link styles when `style` is set to `"specified"`. Can include any of:
  - `"autolink"`: Allow `<https://example.com>` style links
  - `"collapsed"`: Allow `[example][]` style references
  - `"full"`: Allow `[example][reference]` style references
  - `"inline"`: Allow `[example](url)` style links
  - `"shortcut"`: Allow `[example]` style references

Example configuration:

```json
{
  "MD054": {
    "style": "specified",
    "styles": ["inline", "autolink"]
  }
}
```

<!-- markdownlint-disable -->
## Examples

### Valid

When style is set to "inline":

```markdown
[Example link](https://example.com)
```

When style is set to "autolink":

```markdown
<https://example.com>
```

When style is set to "collapsed":

```markdown
[Example][]

[Example]: https://example.com
```

When style is set to "full":

```markdown
[Example][reference]

[reference]: https://example.com
```

### Invalid

When style is set to "inline" but using reference style:

```markdown
[Example][reference]

[reference]: https://example.com
```

### Fixed

```markdown
[Example](https://example.com)
```
<!-- markdownlint-enable -->

## Special Cases

- When style is set to "consistent", the first link style used in the document is enforced
- The rule checks all links in the document, including those in headings, lists, and blockquotes
- Links in code blocks are ignored
- The rule does not apply to image links

## Related Rules

- [MD042 - No Empty Links](md042.md): Ensures links have content
- [MD034 - No Bare URLs](md034.md): Ensures URLs are properly formatted
- [MD039 - No Space in Links](md039.md): Ensures proper link syntax
