Spelling checker for retext.
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');
var doc = 'Some useles mispelt documeant.';
retext().use(spell, dictionary).process(doc, function (err, file) {
if (err) throw err;
console.log(report(file));
});
Yields:
<stdin>
1:6-1:12 warning useles is misspelled spelling
1:13-1:20 warning mispelt is misspelled spelling
1:21-1:30 warning documeant is misspelled spelling
⚠ 3 warnings
retext-spell is async; use the async form of
retext.process
.
Adds warnings for misspelt words to processed virtual files.
Signatures
use(plugin, dictionary)
;use(plugin, options)
.
Parameters
-
spell
— This plug-in. -
dictionary
(Function
) — The result of requiring one of the dictionaries inwooorm/dictionaries
; -
options
(Object
):-
dictionary
— See above; -
ignore
(array?
, defaultnull
) — List of words to ignore. -
ignoreLiteral
(boolean?
, defaulttrue
) — Whether to ignore literal words. -
ignoreDigits
(boolean?
, defaulttrue
) — Whether to ignore "words" that contain only digits, i.e.123456
.
-