All Projects → DataDog → mkdocs-click

DataDog / mkdocs-click

Licence: Apache-2.0 License
An MkDocs extension to generate documentation for Click command line applications

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to mkdocs-click

kotlin-rev-solution
Kotlin reference site in Japanese.
Stars: ✭ 46 (+35.29%)
Mutual labels:  mkdocs
Free-Internet-Plugin
A free Internet is a better Internet. This Chrome browser plugin removes paywalled content from Google search results.
Stars: ✭ 121 (+255.88%)
Mutual labels:  extension
openapi
OpenAPI (fka Swagger) spec renderer for Sphinx.
Stars: ✭ 78 (+129.41%)
Mutual labels:  extension
vscode-react-javascript-snippets
Extension for React/Javascript snippets with search supporting ES7+ and babel features
Stars: ✭ 782 (+2200%)
Mutual labels:  extension
quickwiki
🌐 A Google Chrome extension that allows users to preview articles on Wikipedia and other wikis.
Stars: ✭ 18 (-47.06%)
Mutual labels:  extension
trueChart-Menubar4Sense
MENUBAR as visualization extension for Qlik Sense® allows for vertical and horizontal buttons and selections (fields, master dimensions and variables) as well as unlimited trigger based Actions. #trueChart #menubar #highcoordination
Stars: ✭ 19 (-44.12%)
Mutual labels:  extension
snextensions
A set of open source extensions for StandardNotes you can self-host.
Stars: ✭ 68 (+100%)
Mutual labels:  extension
cpplint-extension
vscode cpplint extension
Stars: ✭ 17 (-50%)
Mutual labels:  extension
mkdocs build plantuml
MkDocs plugin to help generate your plantuml images locally or remotely as files (NOT inline)
Stars: ✭ 31 (-8.82%)
Mutual labels:  mkdocs
mkdocs-htmlproofer-plugin
A MkDocs plugin that validates URL in rendered html files
Stars: ✭ 17 (-50%)
Mutual labels:  mkdocs
How to write cuda extensions in pytorch
How to write cuda kernels or c functions in pytorch, especially for former caffe users.
Stars: ✭ 51 (+50%)
Mutual labels:  extension
alphabetical-grid-extension
Restore the alphabetical ordering of the app grid, removed in GNOME 3.38
Stars: ✭ 43 (+26.47%)
Mutual labels:  extension
mkdocs obsidian template
The template for mkdocs-obsidian
Stars: ✭ 26 (-23.53%)
Mutual labels:  mkdocs
vscode-kafka
Apache Kafka® extension for Visual Studio Code
Stars: ✭ 64 (+88.24%)
Mutual labels:  extension
booklet
The definitive OwnTracks documentation
Stars: ✭ 26 (-23.53%)
Mutual labels:  mkdocs
charon
Decentr browser extension
Stars: ✭ 13 (-61.76%)
Mutual labels:  extension
doxybook2
Doxygen XML to Markdown (or JSON)
Stars: ✭ 140 (+311.76%)
Mutual labels:  mkdocs
protonmail-webextension
Unofficial webextension for ProtonMail
Stars: ✭ 39 (+14.71%)
Mutual labels:  extension
urql-devtools-exchange
The exchange for usage with Urql Devtools
Stars: ✭ 35 (+2.94%)
Mutual labels:  extension
pentadactyl-pm
Pentadactyl for Pale Moon | New official repo is here https://github.com/pentadactyl/pentadactyl
Stars: ✭ 26 (-23.53%)
Mutual labels:  extension

mkdocs-click

Tests Python versions Package version

An MkDocs extension to generate documentation for Click command line applications.

Installation

Install from PyPI:

pip install mkdocs-click

Quickstart

Add mkdocs-click to Markdown extensions in your mkdocs.yml configuration:

site_name: Example
theme: readthedocs

markdown_extensions:
    - mkdocs-click

Add a CLI application, e.g.:

# app/cli.py
import click

@click.group()
def cli():
    """Main entrypoint."""

@cli.command()
@click.option("-d", "--debug", help="Include debug output.")
def build(debug):
    """Build production assets."""

Add a mkdocs-click block in your Markdown:

# CLI Reference

This page provides documentation for our command line tools.

::: mkdocs-click
    :module: app.cli
    :command: cli

Start the docs server:

mkdocs serve

Tada! 💫

Usage

Documenting commands

To add documentation for a command, add a mkdocs-click block where the documentation should be inserted.

Example:

::: mkdocs-click
    :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-click will also generate documentation for sub-commands.

This allows you to generate documentation for an entire CLI application by pointing mkdocs-click at the root command.

Tweaking header levels

By default, mkdocs-click 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.

Full command path headers

By default, mkdocs-click outputs 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 the Attribute Lists extension:

# mkdocs.yaml

markdown_extensions:
    - attr_list
    - mkdocs-click

mkdocs-click will 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 the attr_list extension is required.)

Reference

Block syntax

The syntax for mkdocs-click blocks 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 as command) 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 are plain and table.
  • 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].