Heading Punctuation Check

This rule prevents the use of terminal punctuation (periods, question marks, and exclamation points) at the end of headings. Following Microsoft Style Guide recommendations, headings should not end with punctuation marks as they are unnecessary and can make headings look cluttered or informal.

The rule operates specifically on heading content (scope: heading) and will trigger a warning if it finds these punctuation marks at the end of headings.

Examples:

✗ Incorrect:

  • How to install Python?
  • Welcome to our documentation!
  • Getting Started.

✓ Correct:

  • How to install Python
  • Welcome to our documentation
  • Getting Started

The rule uses a regular expression pattern to match any lowercase letter or number followed by a period, question mark, or exclamation point at the end of the line. When triggered, it automatically suggests removing the punctuation mark from the heading.

Rule Source

This rule comes from: https://github.com/mesosphere/dcos-docs-site

Rule Definition

extends: existence
message: "Don't use end punctuation in headings."
link: https://docs.microsoft.com/en-us/style-guide/punctuation/periods
nonword: true
level: warning
scope: heading
action:
  name: edit
  params:
    - remove
    - '.?!'
tokens:
  - '[a-z0-9][.?!](?:\s|$)'