textlint-rule-prh
textlint rule for prh/prh: proofreading helper.
This rule check the spell by used with prh.yml
.
Installation
npm install textlint-rule-prh
Usage
- It require Rule Options!
{
"rules": {
"prh": {
"rulePaths" :["path/to/prh.yml"]
}
}
}
Options
rulePaths
(required) : array of path to YAML file from .textlintrc
file
{
"rules": {
"prh": {
"rulePaths" :["./prh-rules/rule1.yml", "./prh-rules/rule2.yml"]
}
}
}
You can use ~
as Home directory abbreviation.
{
"rules": {
"prh": {
"rulePaths" :["~/global-rule/rule1.yml"]
}
}
}
checkLink
(optional) : Check Link
node type (default: false
)checkBlockQuote
(optional) : Check BlockQuote
node type (default: false
)checkEmphasis
(optional) : Check Emphasis
node type (default: false
)checkHeader
(optional) : Check Header
node type (default: true
)checkCodeComment
(optional) : Check CodeBlock
node's comment for lang
(default: []
)
- Set
lang
array like ["<codeblock-lang>"]
for checking CodeBlock - Example: If you want to check JavaScript CodeBlock, set
{ "checkCodeComment": ["js", "javascript"] }
Options - Note: Currently only support JavaScript CodeBlock
Examples:
{
"rules": {
"prh": {
"checkEmphasis": true,
"checkHeader": false,
"rulePaths" :["./prh.yml"]
}
}
}
Check CodeBlock's comment in JavaScript Code.
{
"rules": {
"prh": {
"checkCodeComment": ["js", "javascript"],
"rulePaths" :["./prh.yml"]
}
}
}
Fixable
textlint-rule-prh
support --fix
feature of textlint.
textlint --fix README.md
What is prh.yml?
Please See prh/prh: proofreading helper.
prh format
prh.yml
can define RegExp as a dictionary.
version: 1
rules:
- expected: Cookie
- expected: jQuery
specs:
- from: jquery
to: jQuery
- from: JQUERY
to: jQuery
- expected: default
pattern: deflaut
- expected: hardware
patterns:
- hadware
- harrdware
- harddware
- expected: ECMAScript $1
patterns:
- /ECMAScript([0-9]+)/
- /ECMA Script([0-9]+)/
specs:
- from: ECMAScript2015
to: ECMAScript 2015
- expected: ベンダー
pattern: /ベンダ(?!ー)/
specs:
- from: ベンダ
to: ベンダー
- from: ベンダー
to: ベンダー
- expected: js
options:
wordBoundary: true
specs:
- from: foo JS bar
to: foo js bar
- from: foo altJS bar
to: foo altJS bar
imports
prh.yml
can import other yaml file
version: 1
imports:
- imports-a.yml
- imports-b.yml
Example
See example-prh.yml.
Tests
npm test
Contributing
- 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
License
MIT