unified

Project:retextjs/retext-redundant-acronyms

Package:retext-redundant-acronyms@3.0.0

  1. Dependencies:7·Dependents:8
  2. retext plugin to check for redundant acronyms (ATM machine)
  1. unified 135
  2. plugin 123
  3. retext 33
  4. retext-plugin 20

retext-redundant-acronyms

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for redundant acronyms (such as ATM machine to ATM).

Fun fact, this is called RAS syndrome (redundant acronym syndrome syndrome).

Install

npm:

npm install retext-redundant-acronyms

Use

Say we have the following file, example.txt:

Where can I find an ATM machine?

…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 redundantAcronyms = require('retext-redundant-acronyms')

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

Now, running node example yields:

example.txt
  1:21-1:32  warning  Expected `ATM` instead of `ATM machine`  atm  retext-redundant-acronyms

⚠ 1 warning

API

retext().use(redundantAcronyms)

Check for redundant acronyms (such as ATM machine).

Messages

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

message.source

Name of this plugin ('retext-redundant-acronyms').

message.ruleId

Lower case matched abbreviation (string, such as 'atm')

message.actual

Current not ok phrase (string, such as 'ATM machines').

message.expected

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

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