retext-indefinite-article

retext plugin to check if indefinite articles (`a`, `an`) are used correctly

Usage no npm install needed!

<script type="module">
  import retextIndefiniteArticle from 'https://cdn.skypack.dev/retext-indefinite-article';
</script>

README

retext-indefinite-article

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check if indefinite articles (a and an) are used correctly.

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-indefinite-article

Use

Say we have the following file, example.txt:

He should, a 8-year old boy, should have arrived a hour
ago on an European flight.  An historic event, or a
historic event? Both are fine.

…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 retextIndefiniteArticle from 'retext-indefinite-article'
import retextStringify from 'retext-stringify'

const file = readSync('example.txt')

unified()
  .use(retextEnglish)
  .use(retextIndefiniteArticle)
  .use(retextStringify)
  .process(file)
  .then((file) => {
    console.error(reporter(file))
  })

Now, running node example yields:

example.txt
  1:12-1:13  warning  Use `an` before `8-year`, not `a`    retext-indefinite-article  retext-indefinite-article
  1:50-1:51  warning  Use `an` before `hour`, not `a`      retext-indefinite-article  retext-indefinite-article
   2:8-2:10  warning  Use `a` before `European`, not `an`  retext-indefinite-article  retext-indefinite-article

⚠ 3 warnings

API

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

unified().use(retextIndefiniteArticle)

Check if indefinite articles (a and an) are used correctly (which isn’t as simple as checking vowels as it has to do with sounds). Knows about how digits are pronounced as well.

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