# MD047 - Files Should End With a Single Newline Character
## Description
This rule ensures that all files end with a single newline character. This is a common convention in
text files and helps with file concatenation, viewing in terminals, and version control diffs.
Many editors automatically add a newline at the end of a file, but some don't, which can lead to
inconsistent file endings.
## Examples
### Valid
```markdown
# Document Title
This is a paragraph.
```
Note: The file ends with a single newline character after the closing backticks.
### Invalid
```markdown
# Document Title
This is a paragraph.```
Note: The file ends immediately after the closing backticks without a newline.
### Fixed
```markdown
# Document Title
This is a paragraph.
```
Note: A single newline character has been added at the end of the file.
## Special Cases
- This rule only checks for the presence of a single newline character at the end of the file
- It does not check for multiple newline characters (use MD012 for that)
- The rule applies to all Markdown files, regardless of content
- Empty files are considered valid
## Related Rules
- [MD012 - Multiple consecutive blank lines](md012.md): Ensures proper spacing between content
- [MD022 - Headings should be surrounded by blank lines](md022.md): Ensures proper spacing around headings
- [MD031 - Fenced code blocks should be surrounded by blank lines](md031.md): Ensures proper spacing around code blocks