check-spelling: Support ignoring multi-line blocks (e.g. code snippets in markdown files)
I’m trying to add in exclusion for backticked code snippets so the contents don’t get spell checked.
I’ve tried both \x60{1,3}[\s\S]+?\x60{1,3} and \[\n.]+?`` and variations thereof, but can’t seem to get the action to ignore the snippets.
For example:
Section 4 - Encryption
Here is a sample encrypton function:
def encrypt(message: str):
# Do the encryption...
return encrypted_message
The encrypt function takes one parameter…
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 2
- Comments: 16 (9 by maintainers)
That doesn’t ignore the word, it ignores the line containing the word. If you only want to ignore the word, you’d use
\b dBSPL\b/\bdeltadB\bn.b. I’ve copied most of the content from this comment into https://github.com/check-spelling/check-spelling/wiki/Configuration#allow and https://github.com/check-spelling/check-spelling/wiki/Configuration#expect
Allow
(see area dictionaries for other examples):
… They’re really words, just not in the ancient base dictionary. They might not be used today in your project, but there’s no reason for the spell checker to complain to a contributor tomorrow because it’s foreseeable that they might be. – I’ll try to update the wiki to clarify this at some point.
Fwiw, this month I’ve finally started working on a way to collect things like this in a vaguely systematic way. (I made a different draft last summer but didn’t like where it went.)
Expect
Some arbitrary strings that are in test files that aren’t really words. They should be removed if the test are changed/removed.
Allow vs Expect
Roughly if it’s a proper noun of some sort of exists in the real world outside the project, it’s a good candidate for
allow. If it’s just something you’re temporally using that isn’t really a word, it probably belongs inexpect.Note
The bot doesn’t really care. You could put everything into
allowor everything intoexpect. The difference is that the bot will help you remove unused items from expect and add new items to it. You could also periodically migrate items from expect to allow (think about it like Java object lifespan promotions).The second tab of the sheet tries to describe the workflow.
I’ve added some extra comments to the entries in the wiki. Let me know if they’re helpful.
I suppose I could actually include some examples of how they break (as I did above)…