Back to all rules / Format and vendor rules
trailing-whitespace
Lines end in spaces or tabs that change nothing when rendered.
Source: spec.commonmark.org (spec.commonmark.org), read 14 October 2026.
On GitHub: the rule doc and the tests.
Jump to another rule89
What it catches#
Lines end in spaces or tabs that change nothing when rendered.
Lines that end in spaces or tabs that do nothing when the markdown is rendered. Runs that could be a hard line break (two or more spaces before a non-blank line), whitespace after a backslash, fenced code, frontmatter, lines indented four or more columns (they can be code), and the inside of <pre>, <textarea>, <script> and <style> are left alone. The finding points at the first such line and counts the rest. It is a note; with --format github notes are not annotated unless you pass --annotate-notes.
Why it matters#
Trailing spaces and tabs are invisible and do nothing outside a hard line break, but editors that trim them on save turn them into diff noise. Two spaces that may be a hard line break, code and frontmatter are left alone.
Bad example#
Run the tests before you commit.···
Use pnpm, not npm.→
(· is a space, → a tab.) Nobody sees them, and the next editor that trims on save turns a one-line change into a diff of every line that had them.
Good example#
Run the tests before you commit.
Use pnpm, not npm.
How to fix#
Delete the trailing spaces and tabs. asitis lint --fix-preview=safe prints a diff that does only that, and git apply takes it. Most editors can trim trailing whitespace on save for markdown files.
asitis can make this edit for you. asitis lint --fix-preview prints a unified diff that git apply accepts, and the suggest_fixes MCP tool returns the same diff; nothing is written to disk by either. The fix for this rule is marked safe: it does not change what the file says.
Suppress or configure#
For one finding, put a comment on the line above it. The reason after -- is optional but worth writing:
<!-- asitis-disable-next-line trailing-whitespace -- why this one is fine -->
For a whole file:
<!-- asitis-disable-file trailing-whitespace -- why this file is an exception -->
For every file, turn it off or change its severity in .asitisrc.json:
{ "rules": { "trailing-whitespace": "off" } }
A .asitisrc.json overrides entry limits a change to some paths, and a baseline (asitis lint --format json --write-baseline) accepts today's findings so only new ones fail the build.
Source#
spec.commonmark.org, read on 14 October 2026.
See what an agent changed in your CLAUDE.md. Keep or revert each change.
The linter is free and needs no signup. I'm also building a desktop editor for the markdown your agents write and read. It shows what an agent changed since you last looked, lets you keep or revert each change, and never touches a line you didn't edit. No release date yet. One email to confirm, one when the paid beta opens, one when 1.0 ships. $29 once for a founding licence, with 24 months of updates.
Or add the linter to CI, no email needed.
Your address is stored with Cloudflare, which hosts this site. No IP address is kept. See the privacy policy.
Related guides
Run the rule
- In your browser, on one file
- In Claude Code, on the project
- In CI, on every pull request
This page is generated from the plugin's rule registry. Edit it on GitHub. False positive? Open an issue with the line it fired on.