retext-equality

retext plugin to warn about possible insensitive, inconsiderate language

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
retext-equality
14816.6.0a year ago7 years agoMinified + gzip package size for retext-equality in KB

Readme

retext-equality
!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sizesize-badgesize !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
retextretext plugin to check for possible insensitive, inconsiderate language.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.
npm install retext-equality
## Use

Say we have the following file, `example.txt`:

```txt
He’s pretty set on beating your butt for sheriff.

…and our script, example.js, looks like this:
import {readSync} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextEnglish from 'retext-english'
import retextEquality from 'retext-equality'
import retextStringify from 'retext-stringify'

const file = readSync('example.txt')

unified()
  .use(retextEnglish)
  .use(retextEquality)
  .use(retextStringify)
  .process(file)
  .then((file) => {
    console.error(reporter(file))
  })

Now, running node example yields:
example.txt
  1:1-1:5  warning  `He’s` may be insensitive, use `They`, `It` instead  he-she  retext-equality

⚠ 1 warning

API

This package exports no identifiers. The default export is retextEquality.

unified().use(retextEquality[, options])

Check for possible insensitive, inconsiderate language.
options.ignore
List of phrases not to warn about (Array.<string>).
options.noBinary
Do not allow binary references (boolean, default: false). By default he is warned about unless it’s followed by something like or she or and she. When noBinary is true, both cases would be warned about.

Messages

See rules.mdrules for a list of rules and how rules work.
Each message is emitted as a VFileMessagemessage on file, with the following fields:
message.source
Name of this plugin ('retext-equality').
message.ruleId
See id in rules.mdrules.
message.actual
Current not ok phrase (string).
message.expected
Suggest ok phrase (Array.<string>).
message.note
Extra information, when available (string?).

Related

— Catch insensitive, inconsiderate writing
— Check passive voice
— Check for profane and vulgar wording
— Check phrases for simpler alternatives

Contributing

See contributing.mdcontributing in retextjs/.githubhealth for ways to get started. See support.mdsupport for ways to get help.
To create new patterns, add them in the YAML files in the data/script directory, and run npm install and then npm test to build everything. Please see the current patterns for inspiration. New English rules will be automatically added to rules.md.
Once you are happy with the new rule, add a test for it in test.jstest and open a pull request.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MITlicense © Titus Wormerauthor