Avoid spaces before or after a dash (EK00028)
Tight dashes without surrounding spaces match American English style and keep documentation consistent. Learn why to remove spaces around a dash.
American English style sets an em dash or en dash tight against the surrounding words, so remove any space before or after it. EkLine flags a space placed around these dashes (rule EK00028).
Why remove spaces around a dash in documentation?
Section titled “Why remove spaces around a dash in documentation?”An em dash or en dash reads as a firm break, and spaces around it weaken that effect and look inconsistent across a page. Tight dashes match the American English convention most software documentation follows. Uniform dash spacing also keeps diffs clean and prevents awkward line wraps.
What EkLine flags
Section titled “What EkLine flags”EK00028 matches a space directly before or after an em dash or en dash.
- ❌ Incorrect: The result — a clean build — appears in the log.
- ✅ Correct: The result—a clean build—appears in the log.
- ❌ Incorrect: Pages 10 – 20 cover setup.
- ✅ Correct: Pages 10–20 cover setup.
How to fix
Section titled “How to fix”Delete the spaces on either side of the dash so it sits flush against the adjacent words.
Should there be spaces around an em dash?
Section titled “Should there be spaces around an em dash?”In American English, no. Set the em dash tight against the words on both sides, as in “the result—a clean build—appears”. Some styles, such as AP, add spaces, so follow your house style.
What is the difference between an em dash and an en dash?
Section titled “What is the difference between an em dash and an en dash?”An em dash (—) marks a break or aside within a sentence, while the shorter en dash (–) joins ranges and numbers. Neither takes surrounding spaces in American English style.
Rule details
Section titled “Rule details”| Property | Value |
|---|---|
| Rule ID | EK00028 |
| Category | Spelling and grammar |
| Default severity | Error |
| Enabled by default | No |
Ignore this rule
Section titled “Ignore this rule”To keep a spaced dash on one line, add an inline comment:
<!-- ekline-ignore-next-line EK00028 -- AP style uses spaced em dashes -->The result — a clean build — appears in the log.To disable the rule across your project, add it to the ignore list in your configuration file.