lukeapage / node-markdown-spellcheck

spellchecks markdown files
146 stars 58 forks source link

Add option to ignore camelCase, PascalCase, snake_case, and kebab-case #132

Open robellegate opened 5 years ago

robellegate commented 5 years ago

I'm running into an issue where variable names that are being referenced in our documentation md files are being flagged as misspelled because they're using correctly spelled words separated by either underscores(_) or dashes(-).

Along the same lines, it would be nice if compound words in camelCase or PascalCase were ignored too. This might be a bit more difficult to do, but I suppose one method would be to check if there's a capital letter in the middle of a word, split the string into the n words that make up the compound string, and spell check those words.

robellegate commented 5 years ago

It looks like spellcheck.js might already support words separated by dashes(-). https://github.com/lukeapage/node-markdown-spellcheck/blob/master/es6/spellcheck.js#L68-L74

So support for snake_case should be just as easy to implement.

To support camelCase and PascalCase, I think it would require some regex magic for detecting letter case in the middle of words, but after that it should just be able to call the spellchecker on each subword like it currently does for words separated by dashes(-).

m-mohr commented 4 years ago

But then, is fromLondon a typo (i.e. missing space) or a variable? I think variables should be put in an inline code blocks to not check them in spellcheck.