2011/09/20

Primitive automated spell-checking of markdown using sed and ispell

(Why yes, this is a niche post!) Right now this is just a shell script, but it could easily be added to the build process so that a typo (or a new word missing from the project words list) would break the build - no more bad documentation!

#the below regexps remove
# - basic HTML tabs
# - heading hashes
# - code samples
# - inline code
# - URLs
#from markdown-formatted code, as a prelude to spellchecking
cat docs/*.md |
sed -e 's/<[/]*[a-z]*>/ /g' \
-e 's/^[#]*//' \
-e '/```/,/```/ s/.*//' \
-e 's/`.*`//' \
-e 's/\[\([^]]*\)\]([^)]*)/\1/g' \
| ispell -p misc/words.list -l | less

No comments: