Project: retextjs/retext-equality

Package: retext-equality@6.6.0

  1. Dependents: 0
  2. retext plugin to warn about possible insensitive, inconsiderate language
  1. unified 175
  2. plugin 132
  3. retext 36
  4. retext-plugin 22
  5. language 7
  6. writing 3
  7. equal 2
  8. english 2


Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for possible insensitive, inconsiderate language.


What is this?

This package is a unified (retext) plugin to check for certain words that could be considered insensitive, or otherwise inconsiderate, in certain contexts.

When should I use this?

You can opt-into this plugin when you’re dealing with your own text and want to check for potential mistakes.


This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with npm:

npm install retext-equality

In Deno with esm.sh:

import retextEquality from 'https://esm.sh/retext-equality@6'

In browsers with esm.sh:

<script type="module">
  import retextEquality from 'https://esm.sh/retext-equality@6?bundle'


Say our document example.txt contains:

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

…and our module example.js looks as follows:

import {read} 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 = await unified()
  .process(await read('example.txt'))


…now running node example.js yields:

  1:1-1:5  warning  `He’s` may be insensitive, use `They`, `It` instead  he-she  retext-equality

⚠ 1 warning


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

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

Check for possible insensitive, inconsiderate language.


Configuration (optional).


List of phrases not to warn about (Array<string>).


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 will be warned about.


See rules.md for a list of rules and how rules work.

Each message is emitted as a VFileMessage on file, with the following fields:


Name of this plugin ('retext-equality').


See id in rules.md.


Current not ok phrase (string).


Suggest ok phrase (Array<string>).


Extra info, when available (string?).


This package is fully typed with TypeScript. It exports the additional type Options.


Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. Our projects sometimes work with older versions, but this is not guaranteed.


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.

To create new patterns, add them in the YAML files in the data/ directory, and run npm install and then npm test to build everything. Please see the current patterns for inspiration. New English rules will automatically be added to rules.md.

When you are happy with the new rule, add a test for it in test.js, and open a pull request.


MIT © Titus Wormer