Negative Number En Dash Rule

This rule enforces the correct typographical convention for negative numbers by ensuring they use an en dash (–) instead of a hyphen (-). This is an important distinction in professional typography and follows the Microsoft Style Guide's recommendations for formatting negative numbers.

The motivation behind this rule is to maintain consistency in numerical notation and adhere to professional publishing standards. While hyphens and en dashes may look similar, en dashes are the correct typographical mark for indicating negative values. This distinction helps maintain professionalism in technical and formal writing.

Examples:

✅ Correct:

  • The temperature dropped to –20 degrees
  • A value of –5.3 was recorded

❌ Incorrect (will be flagged):

  • The temperature dropped to -20 degrees
  • A value of -5.3 was recorded

Note: The rule specifically looks for patterns where there's a space, followed by a hyphen, followed by numbers, and ending with a space (\s-\d+\s). It will automatically suggest replacing the hyphen (-) with an en dash (–).

Rule Source

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

Rule Definition

extends: existence
message: "Form a negative number with an en dash, not a hyphen."
link: https://docs.microsoft.com/en-us/style-guide/numbers
nonword: true
level: error
action:
  name: edit
  params:
    - replace
    - '-'
    - '–'
tokens:
  - '\s-\d+\s'