textlint rule for prh.
npm install textlint-rule-prhtextlint rule for prh/prh: proofreading helper.
This rule check the spell by used with prh.yml.
npm install textlint-rule-prh
1. It require Rule Options!
``json`
{
"rules": {
"prh": {
"rulePaths" :["path/to/prh.yml"]
}
}
}
- rulePaths(required) : array of path to YAML file from .textlintrc file`
json`
{
"rules": {
"prh": {
"rulePaths" :["./prh-rules/rule1.yml", "./prh-rules/rule2.yml"]
}
}
}
You can use ~ as Home directory abbreviation.
`json`
{
"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)checkParagraph
- (optional) : Check Paragraph node type (default: true)checkCodeComment
- (optional) : Check CodeBlock node's comment for lang (default: [])lang
- Set array like [" for checking CodeBlock{ "checkCodeComment": ["js", "javascript"] }
- Example: If you want to check JavaScript CodeBlock, set Options
- Note: Currently only support JavaScript CodeBlock
- It use @babel/parser
Examples:
`json`
{
"rules": {
"prh": {
"checkEmphasis": true,
"checkHeader": false,
"rulePaths" :["./prh.yml"]
}
}
}
Check CodeBlock's comment in JavaScript Code.
`json`
{
"rules": {
"prh": {
"checkCodeComment": ["js", "javascript"],
"rulePaths" :["./prh.yml"]
}
}
}

textlint-rule-prh support --fix feature of textlint.
`sh`
textlint --fix README.md
Please See prh/prh: proofreading helper.
prh.yml can define RegExp as a dictionary.
`yamlprh version
version: 1
rules:
# format case-sensitive
- expected: Cookie
# the above is equal to following
# - expected: Cookie
# pattern: "/[CcCc][OoOo][OoOo][KkKk][IiIi][EeEe]/g"
# options:
# wordBoundary: false
# specs: []
# Write test to expect
- expected: jQuery
specs:
- from: jquery
to: jQuery
- from: JQUERY
to: jQuery
is failed、fail to load prh.yml as RegExp and /#### imports
prh.yml can import other yaml file`yaml
version: 1imports:
- imports-a.yml
- imports-b.yml
`Example
See example-prh.yml.
Tests
npm test
Contributing
1. Fork it!
2. Create your feature branch:
git checkout -b my-new-feature
3. Commit your changes: git commit -am 'Add some feature'
4. Push to the branch: git push origin my-new-feature`MIT