unified

Project:retextjs/retext-passive

Package:retext-passive@3.0.0

  1. Dependencies:5·Dependents:6
  2. retext plugin to check for passive voice
  1. unified 135
  2. plugin 123
  3. retext 33
  4. retext-plugin 20

retext-passive

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for passive voice.

Install

npm:

npm install retext-passive

Use

Say we have the following file, example.txt:

He was withheld while we were being fed.

…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 passive = require('retext-passive')

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

Now, running node example yields:

example.txt
   1:8-1:16  warning  Don’t use the passive voice  withheld  retext-passive
  1:37-1:40  warning  Don’t use the passive voice  fed       retext-passive

⚠ 2 warnings

API

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

Check for passive voice.

options.ignore

Phrases not to warn about (Array.<string>).

Messages

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

message.source

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

message.ruleId

Any word in list.json.

message.actual

Current not ok phrase (string).

message.expected

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

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