Giter Site home page Giter Site logo

retext-equality's Introduction

retext-equality Build Coverage Downloads 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.

Rules

See rules.md for a list of rules.

Contributing

Thanks, contributions are greatly appreciated! 👍 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.

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

Once you are happy with the new rule, add a test for it in test.js and open a Pull Request.

Related

License

MIT © Titus Wormer

retext-equality's People

Contributors

aaron-em avatar agans avatar ahmedredaamin avatar auotomaton avatar brycekahle avatar catherineetter avatar davesimons avatar eah13 avatar greenkeeperio-bot avatar jenweber avatar missmatsuko avatar nielsonm avatar rtucker avatar rugk avatar sakshamio avatar scottgonzalez avatar shinnn avatar snood1205 avatar veryeli avatar wooorm avatar wuz avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.