retext plugin to check spelling (with nspell
).
npm:
npm install retext-spell
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`? useles retext-spell
1:13-1:22 warning `documeant` is misspelt; did you mean `document`? documeant retext-spell
⚠ 2 warnings
retext-spell
is async; useprocess
, notprocessSync
.
Check spelling (with nspell
).
retext().use(spell, dictionary)
retext().use(spell, options)
A dictionary (Function
).
Result of requiring one of the dictionaries in
wooorm/dictionaries
.
Personal dictionary (string
or a Buffer
in UTF-8, optional).
List of words to ignore (Array.<string>
, default []
).
Whether to ignore literal words (boolean?
, default true
).
Whether to ignore “words” that contain only digits, such as 123456
(boolean?
, default true
).
Deal with apostrophes (boolean?
, default true
).
Whether to swap smart apostrophes (’
) with straight apostrophes ('
) before
checking spelling.
Dictionaries typically support this, but this option can be used if not.
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.
Increasing this number significantly impacts performance.
Each message is emitted as a VFileMessage
on file
, with the
following fields:
Name of this plugin ('retext-spell'
).
Normalized not ok word (string
, such as 'useles'
).
Current not ok word (string
, such as 'Useles'
).
List of suggestions of words to use (Array.<string>
, such as ['Useless']
).
retext-contractions
— Check apostrophe use in contractionsretext-diacritics
— Check for proper use of diacriticsretext-indefinite-article
— Check if indefinite articles (a
,an
) are used correctlyretext-redundant-acronyms
— Check for redundant acronyms (ATM machine
)retext-repeated-words
— Checkfor for
repeated wordsretext-emoji
— Classify emoji, gemoji, emoticons as syntaxretext-syntax-mentions
— Classify @mentions as syntaxretext-syntax-urls
— Classify URLs and filepaths as syntax
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.