unified

Project:retextjs/retext-repeated-words

Package:retext-repeated-words@2.0.0

  1. Dependencies:3·Dependents:15
  2. retext plugin to check for for repeated words
  1. unified 132
  2. plugin 88
  3. retext 33
  4. words 3

retext-repeated-words

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for for repeated words.

Install

npm:

npm install retext-repeated-words

Use

Say we have the following file, example.txt:

Well, it it doesn’t have to to be. Like a fish in the
the sea.

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

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

Now, running node example yields:

example.txt
   1:7-1:12  warning  Expected `it` once, not twice   it   retext-repeated-words
  1:26-1:31  warning  Expected `to` once, not twice   to   retext-repeated-words
   1:51-2:4  warning  Expected `the` once, not twice  the  retext-repeated-words

⚠ 3 warnings

API

retext().use(repeatedWords)

Check for repeated words.

Messages

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

message.source

Name of this plugin ('retext-repeated-words').

message.ruleId

Repeated word (normalized) (string, such as the).

message.actual

Current not ok phrase (string).

message.expected

List of suggestions (Array.<string>, such as ['the']).

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, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer