# MD039 - No Space Inside Link Text

## Description

This rule ensures that there are no spaces inside the square brackets of link text or image alt text.  
Spaces inside link text can cause inconsistent rendering across different Markdown processors.

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

### Valid

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

![Image alt text](image.png)

[Reference link][ref]

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

### Invalid

```markdown
[ Link text with space at the beginning](https://example.com)

[Link text with space at the end ](https://example.com)

[ Link text with spaces at both ends ](https://example.com)

![ Image alt text with spaces ](image.png)
```

### Fixed

```markdown
[Link text with space at the beginning](https://example.com)

[Link text with space at the end](https://example.com)

[Link text with spaces at both ends](https://example.com)

![Image alt text with spaces](image.png)
```
<!-- markdownlint-enable -->

## Special Cases

- This rule applies to both inline links and reference links
- It also applies to image alt text
- The rule checks for spaces immediately inside the opening and closing square brackets
- It does not affect spaces within the link text itself
- The rule does not apply to link definitions, only to link references

## Related Rules

- [MD034 - No bare URLs](md034.md): Ensures URLs are properly formatted
- [MD042 - No empty links](md042.md): Ensures links have content
- [MD051 - Link fragments should be valid](md051.md): Ensures link fragments point to valid headings
