aepfli / markdownlint-rule-max-one-sentence-per-line

A custom markdownlint rule to enforce maximum one sentence per line
MIT License
4 stars 0 forks source link

markdownlint-rule-max-one-sentence-per-line

A custom markdownlint rule to enforce maximum one sentence per line.

Overview

When writing documentation, line-length often is not the most important rule. Some projects tend to ignore line-length and prefer an approach to limit each line to maximum one sentence. For example this allows:

For a better overview it often requires to split a sentence even over multiple lines, which we will not interfere with. This rule will only enforce maximum one sentence per line, but it will not rejoin sentences and adapt the structure, that one sentence will be on just one line.

Installation

Use following command to install

npm install markdownlint-rule-max-one-sentence-per-line --save-dev

Configuration

Tags: sentences

Parameters:

Fixable: Some violations can be fixed by tooling

- First sentence. Second sentence.
+ First sentence.
+ Second sentence.

- > First sentence. Second sentence.
+ > First sentence.
+ > Second sentence.

- * First sentence. Second sentence.
+ * First sentence.
+   Second sentence. <!-- indentation based on provided configuration -->

Usage

For usage with certain tools, please refer to the documentation of markdownlint, markdownlint-cli or the tool you are using.

Attribution

This code was/is based on sentences-per-line by @JoshuaKGoldberg. Instead of parsing per line, we are utilizing the tokenization of markdownlint. Without the groundwork of sentences-per-line this rule would be for certain not in the state it is currently.