retext plugin to check phrases for simpler alternatives.
This package is ESM only:
Node 12+ is needed to use it and it must be import
ed instead of require
d.
npm:
npm install retext-simplify
Say we have the following file, example.txt
:
You can utilize a shorter word.
Be advised, don’t do this.
That’s the appropriate thing to do.
…and our script, example.js
, looks as follows:
import {readSync} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {retext} from 'retext'
import retextSimplify from 'retext-simplify'
const file = readSync('example.txt')
retext()
.use(retextSimplify)
.process(file)
.then((file) => {
console.error(reporter(file))
})
Yields:
example.txt
1:9-1:16 warning Replace `utilize` with `use` utilize retext-simplify
2:1-2:11 warning Remove `Be advised` be-advised retext-simplify
3:12-3:23 warning Replace `appropriate` with `proper`, `right`, or remove it appropriate retext-simplify
⚠ 3 warnings
This package exports no identifiers.
The default export is retextSimplify
.
Check phrases for simpler alternatives.
Phrases not to warn about (Array.<string>
- ruleId
s).
Each message is emitted as a VFileMessage
on file
, with the
following fields:
Name of this plugin ('retext-simplify'
).
Normalized not ok phrase (string
, such as 'utilize'
).
Current not ok phrase (string
, such as 'Utilize'
).
List of suggestions (Array.<string>
, such as ['use']
).
retext-equality
— Check possible insensitive, inconsiderate languageretext-intensify
— Check for weak and mitigating wordingretext-passive
— Check passive voiceretext-profanities
— Check profane and vulgar wording
See contributing.md
in retextjs/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.