retext-profanities
retext plugin to check for profane and vulgar wording
Last updated 4 years ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install retext-profanities 
SYNC missed versions from official npm registry.

retext-profanities

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for profane and vulgar wording. Uses cuss for sureness.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install retext-profanities

Use

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:

import {readSync} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextEnglish from 'retext-english'
import retextProfanities from 'retext-profanities'
import retextStringify from 'retext-stringify'

const file = readSync('example.txt')

unified()
  .use(retextEnglish)
  .use(retextProfanities)
  .use(retextStringify)
  .process(file)
  .then((file) => {
    console.error(reporter(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

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

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

check for profane and vulgar wording. Uses cuss for sureness.

options.ignore

Phrases not to warn about (Array.<string>, default: []).

options.sureness

Minimum sureness to warn about, see cuss (number, default: 0).

Rules

See rules.md for a list of rules.

Note that Latin-script Arabic (retext-profanities/ar-latn), French (retext-profanities/fr), Spanish (retext-profanities/es), Italian (retext-profanities/it), and Portuguese (Brazilian) (retext-profanities/pt) are also supported.

Messages

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:

message.source

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

message.ruleId

See id in rules.md.

message.profanitySeverity

Cuss sureness (number).

message.actual

Profane phrase (string).

message.expected

Empty array to signal that actual should be removed or changed ([]).

Related

Contribute

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.

License

MIT © Titus Wormer

Current Tags

  • 7.2.0                                ...           latest (4 years ago)

23 Versions

  • 7.2.0                                ...           4 years ago
  • 7.1.0                                ...           5 years ago
  • 7.0.0                                ...           5 years ago
  • 6.1.0                                ...           6 years ago
  • 6.0.0                                ...           6 years ago
  • 5.0.0                                ...           7 years ago
  • 4.6.1                                ...           7 years ago
  • 4.6.0                                ...           7 years ago
  • 4.5.0                                ...           7 years ago
  • 4.4.0                                ...           8 years ago
  • 4.3.2                                ...           9 years ago
  • 4.3.1                                ...           9 years ago
  • 4.3.0                                ...           9 years ago
  • 4.2.0                                ...           9 years ago
  • 4.1.0                                ...           9 years ago
  • 4.0.0                                ...           9 years ago
  • 3.1.0                                ...           9 years ago
  • 3.0.1                                ...           10 years ago
  • 3.0.0                                ...           10 years ago
  • 2.1.0                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (8)
Dev Dependencies (15)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |