Skip to content

plugin ¤

MkDocs plugin that generates a manpage at the end of the build.

Classes:

MkdocsManpagePlugin ¤

MkdocsManpagePlugin()

Bases: BasePlugin[PluginConfig]

The MkDocs plugin to generate manpages.

This plugin defines the following event hooks:

  • on_page_content
  • on_post_build

Check the Developing Plugins page of mkdocs for more information about its plugin system.

Methods:

  • on_config

    Save the global MkDocs configuration.

  • on_page_content

    Record pages contents.

  • on_post_build

    Combine all recorded pages contents and convert it to a manual page with Pandoc.

on_config ¤

on_config(config: MkDocsConfig) -> MkDocsConfig | None

Save the global MkDocs configuration.

Hook for the on_config event. In this hook, we save the global MkDocs configuration into an instance variable, to re-use it later.

Parameters:

  • config (MkDocsConfig) –

    The MkDocs config object.

Returns:

  • MkDocsConfig | None

    The same, untouched config.

on_page_content ¤

on_page_content(
    html: str, *, page: Page, **kwargs: Any
) -> str | None

Record pages contents.

Hook for the on_page_content event. In this hook we simply record the HTML of the pages into a dictionary whose keys are the pages' URIs.

Parameters:

  • html (str) –

    The page HTML.

  • page (Page) –

    The page object.

on_post_build ¤

on_post_build(config: MkDocsConfig, **kwargs: Any) -> None

Combine all recorded pages contents and convert it to a manual page with Pandoc.

Hook for the on_post_build event. In this hook we concatenate all previously recorded HTML, and convert it to a manual page with Pandoc.

Parameters:

  • config (MkDocsConfig) –

    MkDocs configuration.