rumdl 0.0.12

A fast Markdown linter written in Rust (Ru(st) MarkDown Linter)
Documentation
# MD053 - Link/Image Reference Definitions Unused

## Description

This rule is triggered when a link or image reference definition is not used anywhere in the document.  
Reference definitions are a way to define URLs separately from the links in the text, but unused references  
clutter the document and can confuse readers.

In Markdown, reference-style links look like this:

```markdown
[Example link][example]

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

And reference-style images:

```markdown
![alt text][reference]

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

The rule ensures that all defined references (`[reference]:`) are actually used in the document, helping maintain clean and efficient documentation.

## Configuration

This rule has the following configuration options:

- `ignored_definitions`: A list of reference names that should be ignored by this rule.

Example configuration:

```json
{
  "MD053": {
    "ignored_definitions": ["footnote", "endnote"]
  }
}
```

| Option | Description | Default |
|--------|-------------|---------|
| `ignored_definitions` | Array of reference names to ignore | `[]` (empty array) |

## Examples

### Valid

```markdown
# Document with References

See [my website][website] for more information.

Learn about [Markdown][markdown] syntax.

![Company Logo][logo]

[website]: https://example.com
[markdown]: https://daringfireball.net/projects/markdown/
[logo]: https://example.com/logo.png
```

### Invalid

```markdown
# Document with Unused References

See [my website](https://example.com) for more information.

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

Warnings:
- Line 5: Unused reference definition 'website'
- Line 6: Unused reference definition 'unused'
- Line 7: Unused reference definition 'another-unused'

### Fixed

```markdown
# Document with Unused References

See [my website](https://example.com) for more information.
```

## Special Cases

- The rule supports shorthand reference links (`[example][]`) which implicitly use the reference name that matches the link text.
- Case-sensitive references are treated as distinct (e.g., `[Reference]` and `[reference]` are different).
- References within code blocks are not considered usage.
- The rule ignores any reference names listed in the `ignored_definitions` configuration.
- The rule checks both link references and image references.
- When fixing the document, the entire reference definition line is removed.

## Related Rules

- [MD052 - Reference Link/Image Not Found]md052.md: Ensures that all reference links and images use references that exist
- [MD042 - No Empty Links]md042.md: Ensures that links have content
- [MD034 - No Bare URLs]md034.md: Ensures URLs are properly formatted