Package: mkdocs-click
mkdocs-clickAn MkDocs extension to generate documentation for Click command line applications.Originally developed byDatadog.InstallationInstall from PyPI:pipinstallmkdocs-clickQuickstartAddmkdocs-clickto Markdown extensions in yourmkdocs.ymlconfiguration:site_name:Exampletheme:readthedocsmarkdown_extensions:-mkdocs-clickAdd a CLI application, e.g.:# app/cli.pyimportclick@click.group()defcli():"""Main entrypoint."""@cli.command()@click.option("-d","--debug",help="Include debug output.")defbuild(debug):"""Build production assets."""Add amkdocs-clickblock in your Markdown:# CLI ReferenceThis page provides documentation for our command line tools.

::: mkdocs-click
    :module: app.cli
    :command: cliStart the docs server:mkdocsserveTada! 💫UsageDocumenting commandsTo add documentation for a command, add amkdocs-clickblock where the documentation should be inserted.Example:::: mkdocs-click
    :module: app.cli
    :command: mainFor all available options, see theBlock syntax.Multi-command supportWhen pointed at a group (or any other multi-command),mkdocs-clickwill also generate documentation for sub-commands.This allows you to generate documentation for an entire CLI application by pointingmkdocs-clickat the root command.Tweaking header levelsBy default,mkdocs-clickgenerates Markdown headers starting at<h1>for the root command section. This is generally what you want when the documentation should fill the entire page.If you are inserting documentation within other Markdown content, you can set the:depth:option to tweak the initial header level. Note that this applies even if you are just adding a heading.By default it is set to0, i.e. headers start at<h1>. If set to1, headers will start at<h2>, and so on. Note that if you insert your own first level heading and leave depth at its default value of 0, the page will have multiple<h1>tags, which is not compatible with themes that generate page-internal menus such as the ReadTheDocs and mkdocs-material themes.Full command path headersBy default,mkdocs-clickoutputs headers that contain the command name. For nested commands such as$ cli build all, this also means the heading would be## all. This might be surprising, and may be harder to navigate at a glance for highly nested CLI apps.If you'd like to show the full command path instead, turn on theAttribute Lists extension:# mkdocs.yamlmarkdown_extensions:-attr_list-mkdocs-clickmkdocs-clickwill then output the full command path in headers (e.g.## cli build all) and permalinks (e.g.#cli-build-all).Note that the table of content (TOC) will still use the command name: the TOC is naturally hierarchal, so full command paths would be redundant. (This exception is why theattr_listextension is required.)ReferenceBlock syntaxThe syntax formkdocs-clickblocks is the following:::: mkdocs-click
    :module: <MODULE>
    :command: <COMMAND>
    :prog_name: <PROG_NAME>
    :depth: <DEPTH>
    :style: <STYLE>Options:module: Path to the module where the command object is located.command: Name of the command object.prog_name:(Optional, default: same ascommand)The name to display for the command.depth:(Optional, default:0)Offset to add when generating headers.style:(Optional, default:plain)Style for the options section. The possible choices areplainandtable.remove_ascii_art:(Optional, default:False)When docstrings begin with the escape character\b, all text will be ignored until the next blank line is encountered.show_hidden:(Optional, default:False)Show commands and options that are marked as hidden.list_subcommands:(Optional, default:False)List subcommands of a given command. Ifattr_listis installed,
add links to subcommands also.