unified

Project: retextjs/retext-indefinite-article

Package: retext-indefinite-article@2.0.1

  1. Dependencies: 5·Dependents: 11
  2. retext plugin to check if indefinite articles (a, an) are used correctly
  1. unified 158
  2. plugin 132
  3. retext 33
  4. retext-plugin 21
  5. article 2

retext-indefinite-article

Build Coverage Downloads Size Sponsors Backers Chat

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

Install

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:

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 indefiniteArticle = require('retext-indefinite-article')

unified()
  .use(english)
  .use(indefiniteArticle)
  .use(stringify)
  .process(vfile.readSync('example.txt'), function(err, file) {
    console.error(report(err || 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

retext().use(indefiniteArticle)

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.

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