These options can be set in
conf.py along with the other Sphinx
String specifying the language, as understood by PyEnchant and enchant. Defaults to
en_USfor US English.
String specifying the tokenizer language as understood by PyEnchant and enchant. Defaults to
en_USfor US English.
String specifying a file containing a list of words known to be spelled correctly but that do not appear in the language dictionary selected by
spelling_lang. The file should contain one word per line. Refer to the PyEnchant tutorial for details. Use a list to add multiple files.
Same as above, but with several files of correctly spelled words.
A list of glob-style patterns that should be ignored when checking spelling. They are matched against the source file names relative to the source directory, using slashes as directory separators on all platforms. See Sphinx’s exclude_patterns option for more details on glob-style patterns.
Boolean controlling whether suggestions for misspelled words are printed. Defaults to False.
Boolean controlling whether the contents of the line containing each misspelled word is printed, for more context about the location of each word. Defaults to True.
Enable or disable the built-in filters to control which words are returned by the tokenizer to be checked.
Boolean controlling whether words that look like package names from PyPI are treated as spelled properly. When
True, the current list of package names is downloaded at the start of the build and used to extend the list of known words in the dictionary. Defaults to
Boolean controlling whether words that follow the CamelCase conventions used for page names in wikis should be treated as spelled properly. Defaults to
Boolean controlling treatment of words that appear in all capital letters, or all capital letters followed by a lower case
True, acronyms are assumed to be spelled properly. Defaults to
Boolean controlling whether names built in to Python should be treated as spelled properly. Defaults to
Boolean controlling whether words that are names of modules found on
sys.pathare treated as spelled properly. Defaults to
Boolean controlling whether contributor names taken from the git history for the repository are considered as spelled correctly.
List of importable filter classes to be added to the tokenizer that produces words to be checked. For example,
["enchant.tokenize.MentionFilter"]. The classes should be derived from
enchant.tokenize.Filter. Refer to the PyEnchant tutorial for examples.
There are two ways to provide a list of known good words. The
spelling_word_list_filename option (described above) specifies the
name of a plain text file containing one word per line. All of the
words in the file are assumed to be spelled correctly and may appear
in any part of the document being processed.
You can use multiple text files with words to be added to the dictionary, to do this all you need to do is use a list and include the name of your text files.
spelling_word_list_filename = ['spelling_wordlist.txt', 'my_wordlist.txt']
spelling directive can be used to create a list of words known
to be spelled correctly within a single file. For example, if a
document refers to a person or project by name, the name can be added
to the list of known words for just that document.
.. spelling:: Docutils Goodger
Custom Word Filters¶
The PyEnchant tokenizer supports a “filtering” API for processing words from the input. Filters can alter the stream of words by adding, replacing, or dropping values.
New filters should be derived from
implement either the
_split() method (to add or replace words) or
_skip() (to treat words as being spelled correctly). For example,
AcronymFilter skips words that are all uppercase letters
or all uppercase with a trailing lowercase “s”.
class AcronymFilter(Filter): """If a word looks like an acronym (all upper case letters), ignore it. """ def _skip(self, word): return (word.isupper() # all caps or # pluralized acronym ("URLs") (word[-1].lower() == 's' and word[:-1].isupper() ) )
To be used in a document, the custom filter needs to be installed
somewhere that Sphinx can import it while processing the input
files. The Sphinx project’s
conf.py then needs two changes.
Import the filter class.
Add the import string for the filter class to the
spelling_filters = ['mymodule.MyFilter']