pax_global_header00006660000000000000000000000064147750017200014515gustar00rootroot0000000000000052 comment=d9dd69d68ca0843f536a9d9ed48f43b726d8133a mkdocs-click-0.9.0/000077500000000000000000000000001477500172000140665ustar00rootroot00000000000000mkdocs-click-0.9.0/.github/000077500000000000000000000000001477500172000154265ustar00rootroot00000000000000mkdocs-click-0.9.0/.github/workflows/000077500000000000000000000000001477500172000174635ustar00rootroot00000000000000mkdocs-click-0.9.0/.github/workflows/autofix.yml000066400000000000000000000014231477500172000216650ustar00rootroot00000000000000name: Auto-fix on: push: pull_request: jobs: style: runs-on: ubuntu-latest steps: - name: Download source uses: actions/checkout@v4 - name: Install Python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install Hatch run: | pip install hatch - name: Install dependencies run: | hatch run style:pip freeze - name: Fix code style run: | hatch run style:fix --fix-only - name: Check if any edits are necessary run: | git diff --color --exit-code - name: Apply automatic fixes using pre-commit-ci-lite if: failure() && github.event_name == 'pull_request' uses: pre-commit-ci/lite-action@v1.1.0 mkdocs-click-0.9.0/.github/workflows/ci.yml000066400000000000000000000025051477500172000206030ustar00rootroot00000000000000name: CI on: push: pull_request: schedule: - cron: '0 6 * * 6' defaults: run: shell: bash jobs: test: strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] python: ["3.9", "3.10", "3.11", "3.12", "3.13"] runs-on: ${{matrix.os}} steps: - name: Download source uses: actions/checkout@v4 - name: Install Python uses: actions/setup-python@v5 with: python-version: ${{matrix.python}} - name: Install Hatch run: | pip install hatch - name: Install dependencies run: | hatch run test:pip freeze - name: Run tests run: | hatch run test:test style: runs-on: ubuntu-latest steps: - name: Download source uses: actions/checkout@v4 - name: Install Python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install Hatch run: | pip install hatch - name: Install dependencies run: | hatch run style:pip freeze hatch run types:pip freeze - name: Check style if: always() run: | hatch run style:check - name: Check types if: always() run: | hatch run types:check mkdocs-click-0.9.0/.github/workflows/deploy-release.yml000066400000000000000000000007651477500172000231300ustar00rootroot00000000000000name: Deploy release on: push: tags: - '*' jobs: pypi: permissions: id-token: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install dependencies run: pip install -U build - name: Build package run: python -m build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 mkdocs-click-0.9.0/.gitignore000066400000000000000000000034311477500172000160570ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .apyre/ # PyCharm .idea/ mkdocs-click-0.9.0/.tools/000077500000000000000000000000001477500172000153045ustar00rootroot00000000000000mkdocs-click-0.9.0/.tools/copier-answers.yml000066400000000000000000000006201477500172000207660ustar00rootroot00000000000000_commit: ed37f1413 _src_path: gh:oprypin/py-project-template copyright_date: '2020' mkdocs: false mkdocs_install_self: false project_description: An MkDocs extension to generate documentation for Click command line applications project_name: mkdocs-click pytest: true python_distribution_name: mkdocs-click python_source_path: mkdocs_click repository_name: mkdocs/mkdocs-redirects script_test: true mkdocs-click-0.9.0/.tools/test.sh000077500000000000000000000001321477500172000166160ustar00rootroot00000000000000#!/bin/sh set -e cd "$(dirname "$0")/.." mkdocs build -q --strict -f example/mkdocs.yml mkdocs-click-0.9.0/CHANGELOG.md000066400000000000000000000050311477500172000156760ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased ## 0.9.0 - 2025-04-07 ### Changed - Drop support for Python 3.8. (Pull #85) ### Added - Add support for `click.Command`-like, `click.Group`-like and `click.Context`-like objects without requiring them to be actual subclasses. (Pull #82) ### Fixed - Remove explicit reference to `click.BaseCommand` and `click.MultiCommand` objects in anticipation of their deprecation. (Pull #82) - Properly ensure whitespace is trimmed from the usage string. (Pull #83) - Propagate `context_settings` to `click.Context`-like objects. (Pull #79) - Allow commands with no options. (Pull #84) ## 0.8.1 - 2023-09-18 ### Fixed - `:prog_name:` and other options can now contain multiple words (it used to stop at whitespace). (Pull #60) - `::: mkdocs-click` directive is now recognized at the end of the file without needing an extra newline. (Pull #69) - Code blocks are marked as ```text so that HighlightJS doesn't try to highlight the "syntax" as some random language. (Pull #61) ## 0.8.0 - 2022-06-19 ### Added - Add `list_subcommands` option. (Pull #55) ## 0.7.0 - 2022-04-28 ### Added - Add `show_hidden` option. (Pull #52) - Update package metadata. (Pull #53) ## 0.6.0 - 2022-04-02 ### Changed - Only support newer versions of `click` in response to a breaking change. (Pull #49) ## 0.5.0 - 2021-11-19 ### Added - Add ability to ignore ASCII art. (Pull #45) ### Fixed - Correctly handle default values of `None`. (Pull #41) ## 0.4.0 - 2021-05-12 ### Added - Relax `click` version constraint. (Pull #39) ## 0.3.0 - 2021-02-19 ### Changed - `--help` is now kept in options (it used to be automatically dropped). (Pull #29) ### Added - Add table formatting. (Pulls #25, #30) - Use `:prog_name:` more consistently in usage. (Pull #24) - Allow using full command paths in headers. (Pull #36) ### Fixed - Make usage and options headings bold to improve legibility. (Pull #31) ## 0.2.0 - 2020-12-09 ### Added - Add `:prog_name:` option to allow overriding the name of the CLI program. (Pull #8, contributed by @frankier.) - Add official support for Python 3.9. (Pull #20) ### Fixed - Properly pin `click==7.*` and `markdown==3.*`. (Pull #19) ## 0.1.1 - 2020-06-05 ### Fixed - Raise proper error when processing unnamed commands. (Pull #4) ## 0.1.0 - 2020-06-04 _Initial implementation._ ### Added - Add `::: mkdocs-click` block with `:module:`, `:command:` and `:depth:` options. mkdocs-click-0.9.0/CONTRIBUTING.md000066400000000000000000000017541477500172000163260ustar00rootroot00000000000000# Contributing guidelines Thank you for being interested in contributing to this project! Here's how to get started. ## Setup To start developing on this project, create a fork of this repository on GitHub, then clone your fork on your machine: ```bash git clone https://github.com//mkdocs-click cd mkdocs-click ``` ## Example docs site You can run the example docs site that lives in `example/` locally using: ```bash hatch run test:mkdocs serve -f example/mkdocs.yml ``` ## Testing and linting You can run the test suite using: ```bash hatch run test:test ``` You can run code auto-formatting and style checks using: ```bash hatch run style:fix ``` ## Releasing _This section is for maintainers._ Before releasing a new version, create a pull request with: - An update to the changelog. - A version bump: see `__version__.py`. Merge the release PR, then create a release on GitHub. A tag will be created which will trigger a GitHub action to publish the new release to PyPI. mkdocs-click-0.9.0/LICENSE000066400000000000000000000261351477500172000151020ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mkdocs-click-0.9.0/README.md000066400000000000000000000107371477500172000153550ustar00rootroot00000000000000# mkdocs-click ![Tests](https://github.com/mkdocs/mkdocs-click/workflows/CI/badge.svg?branch=master) ![Python versions](https://img.shields.io/pypi/pyversions/mkdocs-click.svg) [![PyPI](https://img.shields.io/pypi/v/mkdocs-click)](https://pypi.org/project/mkdocs-click/) An MkDocs extension to generate documentation for Click command line applications. Originally developed by [Datadog](https://www.datadoghq.com). ## Installation Install from PyPI: ```bash pip install mkdocs-click ``` ## Quickstart Add `mkdocs-click` to Markdown extensions in your `mkdocs.yml` configuration: ```yaml site_name: Example theme: readthedocs markdown_extensions: - mkdocs-click ``` Add a CLI application, e.g.: ```python # 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: ```markdown # CLI Reference This page provides documentation for our command line tools. ::: mkdocs-click :module: app.cli :command: cli ``` Start the docs server: ```bash mkdocs serve ``` Tada! 💫 ![](https://raw.githubusercontent.com/DataDog/mkdocs-click/master/docs/example.png) ## Usage ### Documenting commands To add documentation for a command, add a `mkdocs-click` block where the documentation should be inserted. Example: ```markdown ::: mkdocs-click :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-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 `

` 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 `

`. If set to `1`, headers will start at `

`, 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 `

` 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](https://python-markdown.github.io/extensions/attr_list/): ```yaml # 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: ```markdown ::: mkdocs-click :module: :command: :prog_name: :depth: :style: