Check for profane and vulgar wording with retext
Clone or download

readme.md

retext-profanities Build Status Coverage Status

Check for profane and vulgar wording with retext. Uses cuss for sureness.

Installation

npm:

npm install retext-profanities

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 profanities = require('retext-profanities');

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

Now, running node example yields:

example.txt
  1:33-1:37  warning  Be careful with “butt”, it’s profane in some cases  butt  retext-profanities

⚠ 1 warning

API

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

Check for profanities.

options.ignore

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

Rules

See rules.md for a list of rules.

Related

Contribute

See contribute.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