Skip to content

backends ¤

This module contains the different spell checking backends.

Modules:

Name Description
codespell

Backend for the codespell tool.

symspellpy

Backend for the symspellpy library.

Classes:

Name Description
Backend

Abstract class for spelling backends.

Backend(config: dict[str, Any], known_words: set[str] | None = None) ¤

Bases: ABC

Abstract class for spelling backends.

Parameters:

Name Type Description Default
config dict[str, Any]

User configuration from mkdocs.yml.

required
known_words set[str] | None

Globally known words.

None

Methods:

Name Description
check

Check a word appearing in a page.

Source code in src/mkdocs_spellcheck/backends/__init__.py
15
16
17
18
19
20
21
22
23
@abstractmethod
def __init__(self, config: dict[str, Any], known_words: set[str] | None = None) -> None:
    """Initialize the backend.

    Parameters:
        config: User configuration from `mkdocs.yml`.
        known_words: Globally known words.
    """
    raise NotImplementedError

check(page: Page, word: str) -> None abstractmethod ¤

Check a word appearing in a page.

Parameters:

Name Type Description Default
page Page

The MkDocs page the word appears in.

required
word str

The word to check.

required
Source code in src/mkdocs_spellcheck/backends/__init__.py
25
26
27
28
29
30
31
32
33
@abstractmethod
def check(self, page: Page, word: str) -> None:
    """Check a word appearing in a page.

    Parameters:
        page: The MkDocs page the word appears in.
        word: The word to check.
    """
    raise NotImplementedError