retext-redundant-acronyms

retext plugin to check for redundant acronyms (ATM machine)

Usage no npm install needed!

<script type="module">
  import retextRedundantAcronyms from 'https://cdn.skypack.dev/retext-redundant-acronyms';
</script>

README

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

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

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:

import {readSync} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextEnglish from 'retext-english'
import retextRedundantAcronyms from 'retext-redundant-acronyms'
import retextStringify from 'retext-stringify'

const file = readSync('example.txt')

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

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

unified().use(retextRedundantAcronyms)

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']).

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