Check Markdown Spelling with aspell

The venerable aspell spell checking utility has gained some respectable powers over the last year. In this post we explore them to add easy spell checking to our Markdown pipeline.

The good old aspell utility is actually quite up-to-date. One of its many features is a command-line switch, that allows you to tell it the filetype it is about to encounter. With this switch, it becomes a breeze to test all your Markdown files for typos.

for file in *.md
do
aspell check --mode=markdown --lang=en "$file"
done

If you want to store additional words in a per-project file, you can tell aspell the location of a personal dictionary with the --personal parameter, which expects an absolute path:

aspell check --mode=markdown --lang=en --personal="$PWD"/project.list file.md

With aspell’s --mode parameter you can also check HTML files or Perl source code.