Skip to content

mkdocs_plugin ¤

This module contains an optional plugin for MkDocs.

Classes:

MarkdownExecPlugin ¤

Bases: BasePlugin[MarkdownExecPluginConfig]

MkDocs plugin to easily enable custom fences for code blocks execution.

Methods:

on_config ¤

on_config(config: MkDocsConfig) -> MkDocsConfig | None

Configure the plugin.

Hook for the on_config event. In this hook, we add custom fences for all the supported languages.

We also save the Markdown extensions configuration into markdown_config.

Parameters:

  • config (MkDocsConfig) –

    The MkDocs config object.

Returns:

  • MkDocsConfig | None

    The modified config.

MarkdownExecPluginConfig ¤

Bases: Config

Configuration of the plugin (for mkdocs.yml).

Attributes:

  • ansi

    Whether the ansi extra is required when installing the package.

  • languages

    Which languages to enabled the extension for.

ansi class-attribute instance-attribute ¤

ansi = Choice(
    ("auto", "off", "required", True, False), default="auto"
)

Whether the ansi extra is required when installing the package.

languages class-attribute instance-attribute ¤

languages = ListOfItems(
    Choice(keys()), default=list(keys())
)

Which languages to enabled the extension for.