mkdocs-typer


Namemkdocs-typer JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/bruce-szalwinski/mkdocs-typer
SummaryAn MkDocs extension to generate documentation for Typer command line applications
upload_time2023-06-21 16:33:39
maintainer
docs_urlNone
authorBruce Szalwinski
requires_python>=3.7
licenseApache
keywords mkdocs typer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mkdocs-typer

![Tests](https://github.com/bruce-szalwinski/mkdocs-typer/workflows/Tests/badge.svg?branch=main)
![Python versions](https://img.shields.io/pypi/pyversions/mkdocs-typer.svg)
[![Package version](https://badge.fury.io/py/mkdocs-typer.svg)](https://pypi.org/project/mkdocs-typer)

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

## Installation

Install from PyPI:

```bash
pip install mkdocs-typer
```

## Quickstart

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

```yaml
site_name: Example
theme: readthedocs

markdown_extensions:
    - mkdocs-typer
```

Add a CLI application, e.g.:

```python
# 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:

```markdown
# CLI Reference

This page provides documentation for our command line tools.

::: mkdocs-typer
    :module: app.cli
    :command: cli
```

Start the docs server:

```bash
mkdocs serve
```

Tada! 💫

![](https://raw.githubusercontent.com/bruce-szalwinski/mkdocs-typer/master/docs/example.png)

## Usage

### Documenting commands

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

Example:

```markdown
::: mkdocs-typer
    :module: app.cli
    :command: main
```

For all available options, see the [Block syntax](#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:

```markdown
::: 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.


# Changelog



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bruce-szalwinski/mkdocs-typer",
    "name": "mkdocs-typer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "mkdocs typer",
    "author": "Bruce Szalwinski",
    "author_email": "bruce.szalwinski@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/91/1a/b2ac21a04c8e487a1fccc3982f9d91319b83a64c3fc3dc51d89658f43b57/mkdocs_typer-0.0.3.tar.gz",
    "platform": null,
    "description": "# mkdocs-typer\n\n![Tests](https://github.com/bruce-szalwinski/mkdocs-typer/workflows/Tests/badge.svg?branch=main)\n![Python versions](https://img.shields.io/pypi/pyversions/mkdocs-typer.svg)\n[![Package version](https://badge.fury.io/py/mkdocs-typer.svg)](https://pypi.org/project/mkdocs-typer)\n\nAn MkDocs extension to generate documentation for Typer command line applications.\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install mkdocs-typer\n```\n\n## Quickstart\n\nAdd `mkdocs-typer` to Markdown extensions in your `mkdocs.yml` configuration:\n\n```yaml\nsite_name: Example\ntheme: readthedocs\n\nmarkdown_extensions:\n    - mkdocs-typer\n```\n\nAdd a CLI application, e.g.:\n\n```python\n# app/cli.py\nimport typer\n\n\nmy_app = typer.Typer()\n\n\n@my_app.command()\ndef foo():\n    \"\"\"do something fooey\"\"\"\n\n\n@my_app.callback()\ndef cli():\n    \"\"\"\n    Main entrypoint for this dummy program\n    \"\"\"\n```\n\nAdd a `mkdocs-typer` block in your Markdown:\n\n```markdown\n# CLI Reference\n\nThis page provides documentation for our command line tools.\n\n::: mkdocs-typer\n    :module: app.cli\n    :command: cli\n```\n\nStart the docs server:\n\n```bash\nmkdocs serve\n```\n\nTada! \ud83d\udcab\n\n![](https://raw.githubusercontent.com/bruce-szalwinski/mkdocs-typer/master/docs/example.png)\n\n## Usage\n\n### Documenting commands\n\nTo add documentation for a command, add a `mkdocs-typer` block where the documentation should be inserted.\n\nExample:\n\n```markdown\n::: mkdocs-typer\n    :module: app.cli\n    :command: main\n```\n\nFor all available options, see the [Block syntax](#block-syntax).\n\n### Multi-command support\n\nWhen pointed at a group (or any other multi-command), `mkdocs-typer` will also generate documentation for sub-commands.\n\nThis allows you to generate documentation for an entire CLI application by pointing `mkdocs-typer` at the root command.\n\n### Tweaking header levels\n\nBy 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.\n\nIf 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.\n\nBy 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.\n\n## Reference\n\n### Block syntax\n\nThe syntax for `mkdocs-typer` blocks is the following:\n\n```markdown\n::: mkdocs-typer\n    :module: <MODULE>\n    :command: <COMMAND>\n    :prog_name: <PROG_NAME>\n    :depth: <DEPTH>\n```\n\nOptions:\n\n- `module`: path to the module where the command object is located.\n- `command`: name of the command object.\n- `prog_name`: _(Optional, default: same as `command`)_ the name to display for the command.\n- `depth`: _(Optional, default: `0`)_ Offset to add when generating headers.\n\n\n# Changelog\n\n\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "An MkDocs extension to generate documentation for Typer command line applications",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/bruce-szalwinski/mkdocs-typer"
    },
    "split_keywords": [
        "mkdocs",
        "typer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38344d6722b7cdb5e37474272205df6f2080ad01aff74570820a83dedb314f1b",
                "md5": "deb2919e5dd2f1192701528f14c76bba",
                "sha256": "b2a9a44da590a7100114fde4de9123fedfea692d229379984db20ee3b3f12d7c"
            },
            "downloads": -1,
            "filename": "mkdocs_typer-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "deb2919e5dd2f1192701528f14c76bba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11564,
            "upload_time": "2023-06-21T16:33:38",
            "upload_time_iso_8601": "2023-06-21T16:33:38.597392Z",
            "url": "https://files.pythonhosted.org/packages/38/34/4d6722b7cdb5e37474272205df6f2080ad01aff74570820a83dedb314f1b/mkdocs_typer-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "911ab2ac21a04c8e487a1fccc3982f9d91319b83a64c3fc3dc51d89658f43b57",
                "md5": "9558e9e7c3fc34cf6a205e42741c80f6",
                "sha256": "4dd37f024190a82aaf0f6c984faafb15167d34eab7e29a6a85e61362423a4eb7"
            },
            "downloads": -1,
            "filename": "mkdocs_typer-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9558e9e7c3fc34cf6a205e42741c80f6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 11381,
            "upload_time": "2023-06-21T16:33:39",
            "upload_time_iso_8601": "2023-06-21T16:33:39.930799Z",
            "url": "https://files.pythonhosted.org/packages/91/1a/b2ac21a04c8e487a1fccc3982f9d91319b83a64c3fc3dc51d89658f43b57/mkdocs_typer-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-21 16:33:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bruce-szalwinski",
    "github_project": "mkdocs-typer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mkdocs-typer"
}
        
Elapsed time: 0.08194s