Tags: headings
Aliases: no-trailing-punctuation
Fixable: Some violations can be fixed by tooling
This rule is triggered on any heading that has one of the specified normal or full-width punctuation characters as the last character in the line:
# This is a heading.To fix this, remove the trailing punctuation:
# This is a headingpunctuation: Punctuation characters (string, default.,;:!。,;:!)
The punctuation parameter can be used to specify what characters count
as punctuation at the end of a heading. For example, you can change it to
".,;:" to allow headings that end with an exclamation point. ? is
allowed by default because of how common it is in headings of FAQ-style
documents. Setting the punctuation parameter to "" allows all characters -
and is equivalent to disabling the rule.
Example configuration:
[linters.severity]
no-trailing-punctuation = "err"
[linters.settings.no-trailing-punctuation]
punctuation = ".,;:" # Custom punctuation (excludes ! and full-width chars)The trailing semicolon of HTML entity references
like ©, ©, and © is ignored by this rule.
GitHub emoji codes (gemoji) like :smile: and :heart: are also ignored
by this rule.
Headings are not meant to be full sentences. More information: Punctuation at the end of headers.
# This is a good heading
## Another good heading
### FAQ: What is this?
#### How do I use this?
##### Copyright © 2023
###### Happy face :smile:# This heading has a period.
## This heading has an exclamation!
### This heading has a comma,
#### This heading has a semicolon;
##### This heading has a colon:
###### Multiple periods...Both ATX and setext style headings are checked:
This is invalid.
================
This is also invalid!
---------------------