Skip to content

Generator

Generate Markdown documentation for a Click command.

FUNCTION DESCRIPTION
generate_docs

Generate Markdown documentation for a Click command.

Functions

generate_docs

generate_docs(command: BaseCommand, program_name: str | None = None, header_depth: int = 1, style: str = 'plain', depth: int | None = None, exclude: tuple[str, ...] | list[str] = (), show_hidden: bool = False, list_subcommands: bool = False, remove_ascii_art: bool = False, full_command_path: bool = False) -> str

Generate Markdown documentation for a Click command.

PARAMETER DESCRIPTION
command

The Click command to document.

TYPE: BaseCommand

program_name

The display name used in the heading and usage line. Defaults to the command's own name attribute.

TYPE: str | None DEFAULT: None

header_depth

Markdown header level for the command title (1-6).

TYPE: int DEFAULT: 1

style

Options rendering style; "plain" (default) or "table".

TYPE: str DEFAULT: 'plain'

depth

Maximum recursion depth. 0 = root only, None = unlimited.

TYPE: int | None DEFAULT: None

exclude

Dotted command paths to skip (e.g. ("root.admin.reset",)). The root command name is the first segment.

TYPE: tuple[str, ...] | list[str] DEFAULT: ()

show_hidden

Include commands and options marked hidden=True.

TYPE: bool DEFAULT: False

list_subcommands

Prepend a bulleted TOC of direct subcommands at the root.

TYPE: bool DEFAULT: False

remove_ascii_art

Strip \b-prefixed blocks (up to the next blank line).

TYPE: bool DEFAULT: False

full_command_path

Use the full command path in headers (e.g. cli admin).

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

A Markdown string ending with a single newline.