Spelling checker for retext
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

readme.md

retext-spell Build Status Coverage Status

Check spelling with retext, based on nspell.

Installation

npm:

npm install retext-spell

Usage

var retext = require('retext');
var spell = require('retext-spell');
var dictionary = require('dictionary-en-gb');
var report = require('vfile-reporter');

retext()
  .use(spell, dictionary)
  .process('Some useles documeant.', function (err, file) {
    console.error(report(err || file));
  });

Yields:

   1:6-1:12  warning  `useles` is misspelt; did you mean `useless`?      retext-spell  retext-spell
  1:13-1:22  warning  `documeant` is misspelt; did you mean `document`?  retext-spell  retext-spell

⚠ 2 warnings

API

retext().use(spell, options)

retext-spell is async; use process, not processSync.

Adds warnings for misspelt words to processed virtual files.

Signatures
  • retext().use(spell, dictionary)
  • retext().use(spell, options)
options

Optional object.

options.dictionary

A dictionary (Function). Result of requiring one of the dictionaries in wooorm/dictionaries.

options.personal

Personal dictionary (string or a Buffer in utf8, optional).

options.ignore

List of words to ignore (Array.<string>, default []).

options.ignoreLiteral

Whether to ignore literal words (boolean?, default true).

options.ignoreDigits

Whether to ignore “words” that contain only digits, such as 123456 (boolean?, default true).

options.normalizeApostrophes

Deal with apostrophes (boolean?, default true). Whether to swap smart apostrophes () with straight apostrophes (') before checking spelling. Most dictionaries do recognise straight apostrophes (isn't), but not smart apostrophes (isn’t).

options.max

Number of unique words to suggest for (number?, default 30). By default, up to thirty words are suggested for. Further misspellings are still warned about, but without suggestions

Related

Contribute

See contribute.md in retextjs/retext for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer