# MD042 - No Empty Links

## Description

This rule ensures that Markdown links have both a link text and a URL. Empty links can confuse readers  
and cause issues with navigation and accessibility.

Empty links can occur when either the link text or the URL is missing.

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

### Valid

```markdown
[Link text](https://example.com)

[Reference link][reference]

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

### Invalid

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

[Empty URL]()

[ ](https://example.com)

[Visit our website]()
```

### Fixed

```markdown
[Link text](https://example.com)

[Link text](https://example.com)

[Link text](https://example.com)

[Visit our website](https://example.com)
```
<!-- markdownlint-enable -->

## Special Cases

- This rule applies to both inline links and reference links
- It checks for empty link text (square brackets with nothing inside)
- It checks for empty URLs (parentheses with nothing inside)
- The rule does not apply to image links (those starting with !)
- Spaces inside link text are not considered empty

## Related Rules

- [MD034 - No bare URLs](md034.md): Ensures URLs are properly formatted
- [MD039 - No space inside link text](md039.md): Ensures proper formatting of link text
- [MD051 - Link fragments should be valid](md051.md): Ensures link fragments point to valid headings
