commit 48230935e7b38aa266b632a9a82d209a9e1848cf
parent 2096175882d81b3ee27bdc16a14fe7746abaa145
Author: David Eisinger <[email protected]>
Date: Wed, 20 Nov 2024 10:01:01 -0500
Start spelling post
Diffstat:
1 file changed, 85 insertions(+), 0 deletions(-)
diff --git a/content/journal/spellcheck-your-hugo-site-with-cspell/index.md b/content/journal/spellcheck-your-hugo-site-with-cspell/index.md
@@ -0,0 +1,85 @@
+---
+title: "Spellcheck Your Hugo Site With CSpell"
+date: 2024-11-20T09:49:51-05:00
+draft: false
+tags:
+- meta
+---
+
+Bla bla bla
+
+<!--more-->
+
+### 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
+```