# MD021 - No Multiple Spaces in Closed ATX Heading
## Description
This rule ensures that there is only one space between the hash signs (#) and the heading text in closed ATX-style headings.
Multiple spaces can cause inconsistent rendering across different Markdown processors.
## Examples
### Valid
```markdown
# Heading 1 #
## Heading 2 ##
### Heading 3 ###
#### Heading 4 ####
##### Heading 5 #####
###### Heading 6 ######
```
### Invalid
```markdown
# Heading 1 #
## Heading 2 ##
### Heading 3 ###
#### Heading 4 ####
##### Heading 5 #####
###### Heading 6 ######
```
### Fixed
```markdown
# Heading 1 #
## Heading 2 ##
### Heading 3 ###
#### Heading 4 ####
##### Heading 5 #####
###### Heading 6 ######
```
## Special Cases
- This rule only applies to closed ATX-style headings (those with hash signs at both the beginning and end)
- It does not apply to regular ATX headings (those with hash signs only at the beginning)
- It does not apply to setext-style headings (those underlined with = or -)
- Empty headings (just hash signs with no text) are not affected
- The rule checks for multiple spaces both before and after the heading text
## Related Rules
- [MD018 - No missing space in ATX heading](md018.md): Ensures there is a space after the hash signs in regular ATX headings
- [MD019 - No multiple spaces after hash in ATX heading](md019.md): Similar rule for regular ATX headings
- [MD020 - No missing space in closed ATX heading](md020.md): Ensures there is a space between the hash signs and heading text