Time Format Space Check

This rule enforces proper spacing before time expressions in AM/PM format. It ensures there is always a space preceding time expressions written with "am" or "pm" (in various formats). Consistent spacing around time expressions improves readability and maintains professional formatting standards in written content.

Examples:

  • ❌ Wrong: "The meeting starts at3pm"

  • ✅ Right: "The meeting starts at 3pm"

  • ❌ Wrong: "Wake up at6a.m."

  • ✅ Right: "Wake up at 6a.m."

The rule will flag any time expressions where:

  • There's no space before a number followed by "am", "pm", "a.m.", or "p.m." (in various capitalizations)
  • Works with both 1 and 2-digit hour values (e.g., 3pm or 11pm)
  • Catches variations with or without periods (pm, p.m., etc.)

Rule Source

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

Rule Definition

extends: existence
message: "It's standard to put a space before '%s'"
ignorecase: true
level: error
nonword: true
tokens:
  - '\d{1,2}[ap]\.?m\.?'