# MD011 - Reversed link syntax

## Description

This rule checks for reversed link syntax in Markdown documents.
In Markdown, links should be formatted as `[link text](URL)`, but sometimes users accidentally reverse this syntax, writing `[link text](URL)` instead.

The rule identifies these reversed links and provides warnings with automatic fixes to convert them to the correct format.

## Configuration

This rule has no configurable options. It simply identifies and fixes reversed link syntax wherever it appears in the document.

## Examples

<!-- markdownlint-disable -->
### Valid

```markdown
[Visit GitHub](https://github.com)
[Documentation](./docs/README.md)
[Contact us](mailto:example@example.com)
```

These links follow the correct Markdown syntax, with text in square brackets followed by the URL in parentheses.

### Invalid

```markdown
[Visit GitHub](https://github.com)
[Documentation](./docs/README.md)
[Contact us](mailto:example@example.com)
```

In these examples, the link syntax is reversed, with text in parentheses and the URL in square brackets. This is incorrect Markdown syntax and will not render as a proper link in most Markdown processors.

### Fixed

When running the linter with fixes applied, the above invalid links would be transformed to:

```markdown
[Visit GitHub](https://github.com)
[Documentation](./docs/README.md)
[Contact us](mailto:example@example.com)
```
<!-- markdownlint-enable -->

## Special Cases

This rule handles text with nested parentheses correctly. For example:

```markdown
(Text with (nested) parentheses)[https://example.com]
```

would be correctly fixed to:

```markdown
[Text with (nested) parentheses](https://example.com)
```

The rule also processes multiple reversed links in the same line and works with links that are adjacent to other text or within other Markdown elements.

## Related Rules

- [MD034 - Bare URLs](md034.md): Checks for bare URLs that should be enclosed in angle brackets or formatted as proper Markdown links
- [MD039 - Spaces inside link text](md039.md): Checks for spaces inside link text
- [MD042 - Empty links](md042.md): Checks for links with empty text or URLs
