Today I’ve learned how to spellcheck a batch of Markdown files with Aspell, a free software spell checker supporting more than 90 different languages1

This post was written for Debian and should work with any Linux flavour: Ubuntu, Linux Mint, ArchLinux, etc. I didn’t test MacOS but it should be supported too.

1. Install aspell

Here with the english dictionnary:

sudo apt install aspell aspell-en

A list of available dictionnaries can be found on gnu.org

2. Open a terminal

3. Navigate to the root of your project

4. Run the following command:

grep -rlP 'title:' content/ | xargs -o -n1 sh -c 'aspell check "$@" --master=en_US --lang=en_US  --sug-mode=slow -x --mode=markdown < /dev/tty' whatever

(You may want to adjust --master=en_US --lang=en_US)

5. Browse the suggestions and apply with a single keystroke

Shortcuts and suggestions are shown at the bottom of the screen:

A screenshot of Aspell spellchecker with Markdown files

Caveats

There’s one single tiny drawback: when a file is closed, the next one is automatically opened, until the end of the list. I didn’t find a way to exit this loop whitout force quit the terminal.

But I’m fine with it so far: the files are written right after an update, so the modifications are not lost even when force exiting.

References


  1. Supported languages: Arabic, Breton, Esperanto, Kurdi, Quechua, Tamil, Swahili, Yiddish, Zulu, see the complete list ↩︎