2022-10-30 15:13:19 -07:00
|
|
|
# `MD047` - Files should end with a single newline character
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Tags: `blank_lines`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Aliases: `single-trailing-newline`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Fixable: Most violations can be fixed by tooling
|
|
|
|
|
|
|
|
This rule is triggered when there is not a single newline character at the end
|
|
|
|
of a file.
|
|
|
|
|
|
|
|
An example that triggers the rule:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
# Heading
|
|
|
|
|
|
|
|
This file ends without a newline.[EOF]
|
|
|
|
```
|
|
|
|
|
|
|
|
To fix the violation, add a newline character to the end of the file:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
# Heading
|
|
|
|
|
|
|
|
This file ends with a newline.
|
|
|
|
[EOF]
|
|
|
|
```
|
|
|
|
|
|
|
|
Rationale: Some programs have trouble with files that do not end with a newline.
|
2022-11-05 17:34:37 -07:00
|
|
|
|
|
|
|
More information: [What's the point in adding a new line to the end of a
|
|
|
|
file?][stack-exchange]
|
|
|
|
|
|
|
|
[stack-exchange]: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
|