--- title: "Spellcheck Your Hugo Site With CSpell" date: 2024-11-20T09:49:51-05:00 draft: false tags: - meta --- Bla bla bla ### 1. Install CSpell ### 2. Add config file ### 3. Ignore frontmatter ### 4. Ignore proper nouns ### 5. Fix spelling ### 6. Create custom dictionary ### 7. Add to build pipeline --- [Here's the final `.cspell.json` config file.][1] [1]: https://git.sr.ht/~dce/davideisinger.com/tree/main/item/.cspell.json [2]: https://cspell.org/ [3]: https://github.com/streetsidesoftware/cspell/discussions/3456#discussioncomment-3438647 [4]: https://git.sr.ht/~dce/davideisinger.com/tree/main/item/.build.yml#L23-24 ```json { "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", "version": "0.2", "dictionaryDefinitions": [ { "name": "exceptions", "path": ".dictionary", "addWords": true } ], "dictionaries": [ "english", "ruby", "golang", "exceptions" ], "patterns": [ { "name": "frontmatter", "pattern": "/^(-{3}|[+]{3})$(\\s|\\S)*?^\\1$/gm" }, { "name": "proper_nouns", "pattern": "/[\\W_][A-Z][\\S]+/g" } ], "languageSettings": [ { "languageId": "markdown", "ignoreRegExpList": [ "frontmatter", "proper_nouns" ] } ] } ``` ```sh npx cspell content/**/*.md ``` ```sh npx cspell --words-only --unique content/**/*.md >> .dictionary ``` ```sh sort -o .dictionary .dictionary ```