README
retext-redundant-acronyms
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 import
ed instead of require
d.
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
retext-indefinite-article
— Check if indefinite articles are used correctlyretext-repeated-words
— Checkfor for
repeated words
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.