Skip to content

Commit 375fea7

Browse files
committed
DOC: added section about disabling spell checking
Describe the 'spell-check-disable' and 'spell-check-enable' Also added slash before all single quotes. This bug was messing up pandoc's formatting.
1 parent fd32cbd commit 375fea7

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

README.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,66 @@ Here is how it is typically run:
1111

1212
python comment_spell_check.py --exclude Ancillary $SIMPLEITK_SOURCE_DIR/Code
1313

14-
This command will recursively find all the '.h' files in a directory,
14+
This command will recursively find all the \'.h\' files in a directory,
1515
extract the C/C++ comments from the code, and run a spell checker on them.
16-
The **'--exclude'** flag tells the script to ignore any file that has
17-
'Ancillary' in its full path name. This flag will accept any
16+
The **\'\-\-exclude\'** flag tells the script to ignore any file that has
17+
\'Ancillary\' in its full path name. This flag will accept any
1818
regular expression.
1919

20-
In addition to pyenchant's English dictionary, we use the words in
20+
In addition to pyenchant\'s English dictionary, we use the words in
2121
**additional_dictionary.txt**. These words are proper names and
2222
technical terms harvest by hand from the SimpleITK and ITK code bases.
2323

2424
If a word is not found in the dictionaries, we try two additional checks.
2525

2626
1. If the word starts with some known prefix, the prefix is removed
27-
...and the remaining word is checked against the dictionary. The prefixes
28-
...used by default are **'sitk'**, **'itk'**, and **'vtk'**. Additional
29-
...prefixes can be specified with the **'--prefix'** command line argument.
27+
and the remaining word is checked against the dictionary. The prefixes
28+
used by default are **\'sitk\'**, **\'itk\'**, and **\'vtk\'**. Additional
29+
prefixes can be specified with the **\'\-\-prefix\'** command line argument.
3030

3131
2. We attempt to split the word by capitalization and check each
32-
...sub-word against the dictionary. This method is an attempt to detect
33-
...camel-case words such as 'GetArrayFromImage', which would get split into
34-
...'Get', 'Array', 'From', and 'Image'. Camel-case words are very commonly
35-
...used for code elements.
32+
sub\-word against the dictionary. This method is an attempt to detect
33+
camel-case words such as \'GetArrayFromImage\', which would get split into
34+
\'Get\', \'Array\', \'From\', and \'Image\'. Camel-case words are very commonly
35+
used for code elements.
3636

37-
The script can also process other file types. With the **'--suffix'**
37+
The script can also process other file types. With the **\'\-\-suffix\'**
3838
option, the following file types are available: Python (.py), C/C++
3939
(.c/.cxx), CSharp (.cs), Text (.txt), reStructuredText(.rst), Markdown (.md),
4040
Ruby (.ruby), R (.R), and Java (.java). Note that reStructuredText files are
4141
treated as standard text. Consequentially, all markup keywords that are not
4242
actual words will need to be added to the additional/exception dictionary.
4343

44+
## Disabling Spell Checking
45+
46+
Spell checking can be disabled for sections of code by using special
47+
48+
comments. The following comments will disable spell checking until
49+
the corresponding end comment is found.
50+
```
51+
// spell-check-disable
52+
53+
// This comment will not be spell checked.
54+
55+
// spell-check-enable
56+
```
57+
58+
Note that for C-style, multi-line comments, the disable and enable
59+
comments must be in seperate comments. If the disable command
60+
is found in a multi-line comment, spell checking will be
61+
disabled for the entire multi-line comment.
62+
63+
```
64+
/*
65+
spell-check-disable
66+
spell-check-enable
67+
This comment will NOT be spell checked
68+
*/
69+
/* spell-check-enable */
70+
/* This comment WILL be spell checked */
71+
```
72+
73+
4474
## Dictionary notes
4575

4676
We use [PySpellChecker](https://github.com/barrust/pyspellchecker) as the

0 commit comments

Comments
 (0)