Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
An MkDocs extension to generate documentation for Typer command line applications
An MkDocs extension to generate documentation for Typer command line applications.
Install from PyPI:
pip install mkdocs-typer
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! 💫
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.
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.
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.
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 as command
) the name to display for the command.depth
: (Optional, default: 0
) Offset to add when generating headers.FAQs
An MkDocs extension to generate documentation for Typer command line applications
We found that mkdocs-typer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.