Reads markdown files and spellchecks them, using open source Hunspell dictionary files.
There are two modes, interactive fixing, which will allow you to fix mistakes and add exceptions to a custom dictionary and a report mode which will just report the list of errors.
# install
npm i markdown-spellcheck -g
# run in interactive mode
mdspell "**/*.md"
# see help & options
mdspell
Multiple patterns can be used on the command line and can use !
for negation. E.g.
mdspell '**/*.md' '!**/node_modules/**/*.md'
Ignores numbers like 1.2
and 1,2.4
.
Ignores acronyms like NPM
. Also ignores numbers. Does not ignore single letters e.g. U
.
Suggestions are slow at present, so use this to remove them.
Use the American English dictionary. We default to British English but will change in the next major to American.
Use the British English dictionary. We default default to British English but will change in the next major to American.
Use the Spanish dictionary.
Specify a custom Hunspell dictionary to load. The passed filename should not include a file extension and markdown-spellcheck
will attempt to load the file with .aif
and .dic
extensions.
The default interactive mode shows you the context of the spelling mistake and gives you options with what to do about it. E.g.
Spelling - readme.md
shows you the context of the speling mistake and gives you options
? (Use arrow keys)
Ignore
Add to file ignores
Add to dictionary - case insensitive
> Enter correct spelling
spelling
spieling
spewing
selling
peeling
Where speling
will be highlighted in red.
- "Ignore" will ignore that word and not ask about it again in the current run. If you re-run the command again though, it will appear.
- "Add to file ignores" will ignore the word in this file only.
- "Add to dictionary - case insensitive" will add to the dictionary for all files and match any case. E.g. with the word
Microsoft
bothMicrosoft
andmicrosoft
would match. - "Add to dictionary - case sensitive" will add to the dictionary for all files and match the case that has been used. E.g. with the word
Microsoft
, the wordmicrosoft
will not match.
All exclusions will be stored in a .spelling
file in the directory from which you run the command.
Using the --report
(-r
) option will show a report of all the spelling mistakes that have been found. This mode is useful for CI build reports.
The .spelling
file is self documenting as it includes...
# markdown-spellcheck spelling configuration file
# Format - lines begining # are comments
# global dictionary is at the start, file overrides afterwards
# one word per line, to define a file override use ' - filename'
# where filename is relative to this configuration file
Add to your package.json
and then run in report mode. If new spelling errors occur that are not ignored in the .spelling
file, a error exit code will be set.
For instance, if your package.json
has:
"scripts": {
"test": "gulp test"
},
Change it to...
"scripts": {
"test": "mdspell -r **/*.md && gulp test"
},
See grunt-mdspell.
See https://github.com/marcoagpinto/aoo-mozilla-en-dict.
Missing word? Raise it at https://github.com/marcoagpinto/aoo-mozilla-en-dict/issues.
See http://wordlist.aspell.net/dicts/.
Missing word? Raise it at https://github.com/kevina/wordlist/issues.