Mkdocs rich argparse
An MkDocs plugin to generate documentation for a rich argparse parser. It renders commands, sub commands and sub-sub commands which can have rich help messages.
Installation
pip install mkdocs-rich-argparse
Usage
TL;DR: Set package to your installed CLI package's project name and add
cli.md to your navigation.
-
Define your commands in your package's
pyproject.tomlusing[project.scripts]:[project] name = "my-package" [project.scripts] myprogram = "my_package.cli:main" mysecondprogram = "my_package.cli:download"
-
Ensure your CLI package is installed alongside the plugin so its script metadata is available.
-
In
mkdocs.yml, setpackageto the[project].namevalue from yourpyproject.tomland add the generated page to your navigation:plugins: - mkdocs-rich-argparse: package: my-package nav: - CLI Reference: cli.md
Parsers are captured at parse_args() or parse_known_args(). Code before
parsing still executes during the documentation build.
See the example/ directory for a minimal example and a custom styled example.
Configuration
package is required. All other plugin settings are optional and belong under
mkdocs-rich-argparse in mkdocs.yml:
| Setting | Default | Description |
|---|---|---|
src_uri |
cli.md |
Generated page path relative to the docs directory. Update nav to match. |
heading |
CLI Reference |
Top-level heading of the generated page. |
order |
[] |
Script names to document first, in the specified order. |
styles |
See below | Rich styles for the generated help text. |
For example, customize the page path and heading and put your main script first:
plugins:
- mkdocs-rich-argparse:
package: my-package
src_uri: reference/commands.md
heading: Commands
order:
- myprogram
nav:
- Commands: reference/commands.md
Scripts listed in order appear first, in the specified order.
All remaining scripts are sorted alphabetically.
Unknown or duplicate script names cause a build error.
If no order is specified, all scripts are sorted alphabetically.
Styles
The styles mapping accepts Rich style strings for args, groups, help,
metavar, syntax, text, and default. The plugin sets help and text to
green by default so they remain visible in dark mode. Other values keep the
current RichHelpFormatter styles unless overridden.
plugins:
- mkdocs-rich-argparse:
package: my-package
styles:
args: bright_red
groups: bright_green
metavar: bright_magenta
syntax: dark_orange
help: bright_cyan
text: bright_yellow
default: bright_black
Colors in Continuous Integration
To preserve Rich colors in CI, set these environment variables (GitHub Actions example):
env:
TTY_COMPATIBLE: '1'
TTY_INTERACTIVE: '0'
Contributing
If you want to contribute to the development of mkdocs_rich_argparse, have a look at the contribution guidelines.
Metadata
Release files for mkdocs-rich-argparse 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs_rich_argparse-0.2.0.tar.gz | 189.8 kB | With provenance | Details for mkdocs_rich_argparse-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_rich_argparse-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_rich_argparse-0.2.0-py3-none-any.whl |
Total release size: 204.6 kB
Release files / mkdocs_rich_argparse-0.2.0.tar.gz
| Download URL | mkdocs_rich_argparse-0.2.0.tar.gz |
|---|---|
| Size | 189.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbec87012fd991e380388b838d7213228942ca918f05a6826a2124a297082f8b
|
|
BLAKE2b-256 checksum How to use checksums |
3a98fbf9a1cbe023e59ce5689f68051d32eb0db9f5e3e29eb68618c39ca4fc03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logRelease files / mkdocs_rich_argparse-0.2.0-py3-none-any.whl
| Download URL | mkdocs_rich_argparse-0.2.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
742e5ac5b0b6ee07426262c94b851c6da7b281a553f07c8b2331f9e212fe98cb
|
|
BLAKE2b-256 checksum How to use checksums |
10d1f949b24cf4a7bcaf1f125e6b9c240980f2841acc8de8d1ec1f07f1ecfadc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logSecurity for mkdocs-rich-argparse 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mkdocs_rich_argparse-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.