textlint-rule-idiomatic-lines
v1.1.8
Published
textlint rule that enforces one sentence per line and one line per sentence
Readme
textlint-rule-idiomatic-lines
A textlint rule that enforces one sentence per line and one line per sentence.
This style, sometimes called semantic linefeeds, makes prose easier to diff, review, and rearrange in version control.
Rules
The rule reports two kinds of violations:
Multiple sentences on one line Two or more sentences appear on the same line.
Bad:
The sky is blue. The grass is green.Good:
The sky is blue.
The grass is green.Sentence spanning multiple lines A single sentence is broken across lines without a blank line (paragraph break) between them.
Bad:
The sky is a lovely shade
of blue today.Good:
The sky is a lovely shade of blue today.Installation
npm install textlint-rule-idiomatic-linesUsage
Add the rule to your .textlintrc.json:
{
"rules": {
"idiomatic-lines": true
}
}Then run textlint:
npx textlint "docs/**/*.md"Scope
The rule only inspects Paragraph nodes in the Markdown AST. The following constructs are not checked and will never produce false positives:
- Headings
- List items
- Fenced code blocks
- Indented code blocks
- Inline code spans (e.g.
obj.method())
Blockquote content is checked, because blockquotes contain paragraphs.
Sentence detection
Sentence boundaries are detected by sentence-splitter.
It handles common abbreviations (Dr., Mr., e.g.), decimal numbers (3.14), and ellipses (...).
Development
This project uses node-tool-wrapper so you don't need Node.js or npm installed globally.
./npmw install
./npmw test # run unit + integration tests
./npmw run build # compile TypeScript to lib/License
MIT
