JSPM

  • Created
  • Published
  • Downloads 26605
  • Score
    100M100P100Q160185F
  • License MIT

Warn about possible insensitive, inconsiderate language with Retext

Package Exports

  • retext-equality
  • retext-equality/lib/patterns.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (retext-equality) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

retext-equality Build Status Coverage Status Chat

Warn about possible insensitive, inconsiderate language with retext.

Installation

npm:

npm install retext-equality

Usage

Say we have the following file, example.txt:

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

And our script, example.js, looks like this:

var vfile = require('to-vfile')
var report = require('vfile-reporter')
var unified = require('unified')
var english = require('retext-english')
var stringify = require('retext-stringify')
var equality = require('retext-equality')

unified()
  .use(english)
  .use(equality)
  .use(stringify)
  .process(vfile.readSync('example.txt'), function(err, file) {
    console.error(report(err || file))
  })

Now, running node example yields:

example.txt
    1:1-1:4  warning  `His` may be insensitive, use `Their`, `Theirs`, `Them` instead           her-him       retext-equality
  1:31-1:37  warning  `master` / `slave` may be insensitive, use `primary` / `replica` instead  master-slave  retext-equality

⚠ 2 warnings

API

retext().use(equality[, options])

Adds warnings for possible insensitive, inconsiderate language to the processed virtual files.

options
options.ignore

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

options.noBinary

boolean, default: false — Do not allow binary references. 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.

Contributing

Thanks, contributions are greatly appreciated! 👍 If you add new patterns, add them in the YAML files in the script/ directory, and run npm install and then npm test to build everything.

Please see the current patterns for inspiration.

Rules

See rules.md for a list of rules.

Contribute

See contributing.md in retextjs/retext for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer