mkdocs-typer
An MkDocs extension to generate documentation for Typer command line applications.
Installation
Install from PyPI:
pip install mkdocs-typer
Quickstart
Add mkdocs-typer to Markdown extensions in your mkdocs.yml configuration:
site_name: Example
theme: readthedocs
markdown_extensions:
- mkdocs-typer
Add a CLI application, e.g.:
# app/cli.py
import typer
my_app = typer.Typer()
@my_app.command()
def foo():
"""do something fooey"""
@my_app.callback()
def cli():
"""
Main entrypoint for this dummy program
"""
Add a mkdocs-typer block in your Markdown:
# CLI Reference
This page provides documentation for our command line tools.
::: mkdocs-typer
:module: app.cli
:command: cli
Start the docs server:
mkdocs serve
Tada! 💫
Usage
Documenting commands
To add documentation for a command, add a mkdocs-typer block where the documentation should be inserted.
Example:
::: mkdocs-typer
:module: app.cli
:command: main
For all available options, see the Block syntax.
Multi-command support
When pointed at a group (or any other multi-command), mkdocs-typer will also generate documentation for sub-commands.
This allows you to generate documentation for an entire CLI application by pointing mkdocs-typer at the root command.
Tweaking header levels
By default, mkdocs-typer generates 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 to 0, i.e. headers start at <h1>. If set to 1, 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.
Reference
Block syntax
The syntax for mkdocs-typer blocks is the following:
::: mkdocs-typer
:module: <MODULE>
:command: <COMMAND>
:prog_name: <PROG_NAME>
:depth: <DEPTH>
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.
Changelog
Metadata
Release files for mkdocs-typer 0.0.3
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_typer-0.0.3.tar.gz | 11.4 kB | Without provenance | Details for mkdocs_typer-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_typer-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_typer-0.0.3-py3-none-any.whl |
Total release size: 22.9 kB
Release files / mkdocs_typer-0.0.3.tar.gz
| Download URL | mkdocs_typer-0.0.3.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dd37f024190a82aaf0f6c984faafb15167d34eab7e29a6a85e61362423a4eb7
|
|
BLAKE2b-256 checksum How to use checksums |
911ab2ac21a04c8e487a1fccc3982f9d91319b83a64c3fc3dc51d89658f43b57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.17
|
Release files / mkdocs_typer-0.0.3-py3-none-any.whl
| Download URL | mkdocs_typer-0.0.3-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2a9a44da590a7100114fde4de9123fedfea692d229379984db20ee3b3f12d7c
|
|
BLAKE2b-256 checksum How to use checksums |
38344d6722b7cdb5e37474272205df6f2080ad01aff74570820a83dedb314f1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.17
|
Security for mkdocs-typer 0.0.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.