- Notifications
You must be signed in to change notification settings - Fork3
textlint rule that limit maximum length of sentence.
License
NotificationsYou must be signed in to change notification settings
textlint-rule/textlint-rule-sentence-length
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
textlint rule that limit Maximum Length of Sentence.
npm install textlint-rule-sentence-length
Add "sentence-length" to your.textlintrc
.
{ "rules": { "sentence-length": true }}
max
- default: 100
- The total number of characters allowed on each sentences.
- Sentence.length > 100 and throw Error
skipPatterns
:string[]
- A strings that match the patterns is uncounted of the sentence.
- Set an array of RegExp-like string.
- Seehttps://github.com/textlint/regexp-string-matcher
skipUrlStringLink
:boolean
- Default:
true
- If it is
true
, skip url string link node like<https:example.com>
or[https://example.com](https://example.com)
- url string link is has the text which is same of url.
- Default:
countBy
:"codeunits" | "codepoints"
- Determine how to count string length
- Issue:#44
- Default
"codeunits"
{ "rules": { "sentence-length": { "max": 100 } }}
Uncount(...)
fromA sentence(...).
{ "rules": { "sentence-length": { "max": 100, "skipPatterns": [ "/\\(.*\\)$\\./" ] } }}
This rule usesentence-splitter as library.So the definition of "Sentence" is the same as sentence-splitter.
For example, the following text is 3 sentences.
We are talking about pens.He said "This is a pen. I like it".I could relate to that statement.
Second line includes"..."
, but this rule treat second line as a single sentence.
If you want to ignore"..."
, you can useskipPatterns
option.
{ "rules": { "sentence-length": { "max": 100, "skipPatterns": [ "/\".*?\"/" ] } }}
- Except BlockQuote
- Except a single link node
- Except url string link (
skipUrlStringLink
)
OK:
> LONG LONG LONG LONG LONG LONG LONG LONG Quote text. But it is quote text.a single link node ↓[textlint/textlint-filter-rule-comments: textlint filter rule that disables all rules between comments directive.](https://github.com/textlint/textlint-filter-rule-comments)Very long https://example.com?longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong url.
NG:
This sentence includes one link and two Str.
This is [textlint/textlint-filter-rule-comments: textlint filter rule that disables all rules between comments directive.](https://github.com/textlint/textlint-filter-rule-comments).
SeeOther rules
npm test
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT
About
textlint rule that limit maximum length of sentence.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Contributors3
Uh oh!
There was an error while loading.Please reload this page.