|
1 |
| -# mkdocstrings-python (legacy) |
| 1 | +<h1 align="center">mkdocstrings-python-legacy</h1> |
2 | 2 |
|
3 |
| -[](https://github.com/mkdocstrings/python-legacy/actions?query=workflow%3Aci) |
4 |
| -[](https://mkdocstrings.github.io/python-legacy/) |
5 |
| -[](https://pypi.org/project/mkdocstrings-python-legacy/) |
6 |
| -[](https://gitpod.io/#https://github.com/mkdocstrings/python-legacy) |
7 |
| -[](https://gitter.im/mkdocstrings/python-legacy) |
| 3 | +<p align="center">The legacy Python handler for <a href="https://github.com/mkdocstrings/mkdocstrings"><i>mkdocstrings</i></a>.</p> |
8 | 4 |
|
9 |
| -A legacy Python handler for mkdocstrings. |
| 5 | +<p align="center"> |
| 6 | + <a href="https://github.com/mkdocstrings/python-legacy/actions?query=workflow%3Aci"> |
| 7 | + <img alt="ci" src="https://github.com/mkdocstrings/python-legacy/workflows/ci/badge.svg" /> |
| 8 | + </a> |
| 9 | + <a href="https://mkdocstrings.github.io/python-legacy/"> |
| 10 | + <img alt="documentation" src="https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat" /> |
| 11 | + </a> |
| 12 | + <a href="https://pypi.org/project/mkdocstrings-python-legacy/"> |
| 13 | + <img alt="pypi version" src="https://img.shields.io/pypi/v/mkdocstrings-python-legacy.svg" /> |
| 14 | + </a> |
| 15 | + <a href="https://gitpod.io/#https://github.com/mkdocstrings/python-legacy"> |
| 16 | + <img alt="gitpod" src="https://img.shields.io/badge/gitpod-workspace-blue.svg?style=flat" /> |
| 17 | + </a> |
| 18 | + <a href="https://gitter.im/mkdocstrings/python-legacy"> |
| 19 | + <img alt="gitter" src="https://badges.gitter.im/join%20chat.svg" /> |
| 20 | + </a> |
| 21 | +</p> |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +<p align="center"><img src="logo.png"></p> |
| 26 | + |
| 27 | +WARNING: We suggest using the new handler instead: |
| 28 | +[mkdocstrings-python](https://mkdocstrings.github.io/python/). |
10 | 29 |
|
11 | 30 | ## Installation
|
12 | 31 |
|
13 |
| -With `pip`: |
14 |
| -```bash |
15 |
| -pip install mkdocstrings-python-legacy |
| 32 | +You can install this handler as a *mkdocstrings* extra: |
| 33 | + |
| 34 | +```toml title="pyproject.toml" |
| 35 | +# PEP 621 dependencies declaration |
| 36 | +# adapt to your dependencies manager |
| 37 | +[project] |
| 38 | +dependencies = [ |
| 39 | + "mkdocstrings[python-legacy]>=0.18", |
| 40 | +] |
16 | 41 | ```
|
17 | 42 |
|
18 |
| -With [`pipx`](https://github.com/pipxproject/pipx): |
19 |
| -```bash |
20 |
| -python3.7 -m pip install --user pipx |
21 |
| -pipx install mkdocstrings-python-legacy |
| 43 | +You can also explicitely depend on the handler: |
| 44 | + |
| 45 | +```toml title="pyproject.toml" |
| 46 | +# PEP 621 dependencies declaration |
| 47 | +# adapt to your dependencies manager |
| 48 | +[project] |
| 49 | +dependencies = [ |
| 50 | + "mkdocstrings-python-legacy", |
| 51 | +] |
22 | 52 | ```
|
| 53 | + |
| 54 | +## Preview |
| 55 | + |
| 56 | +<!-- TODO: update the GIF with a more recent screen capture. Maybe use mp4 instead --> |
| 57 | + |
| 58 | + |
| 59 | +## Features |
| 60 | + |
| 61 | +- **Data collection from source code**: collection of the object-tree and the docstrings is done thanks to |
| 62 | + [pytkdocs](https://github.com/mkdocstrings/pytkdocs). |
| 63 | + |
| 64 | +- **Support for type annotations:** pytkdocs collects your type annotations and *mkdocstrings* uses them |
| 65 | + to display parameters types or return types. |
| 66 | + |
| 67 | +- **Recursive documentation of Python objects:** just use the module dotted-path as identifier, and you get the full |
| 68 | + module docs. You don't need to inject documentation for each class, function, etc. |
| 69 | + |
| 70 | +- **Support for documented attributes:** attributes (variables) followed by a docstring (triple-quoted string) will |
| 71 | + be recognized by Griffe in modules, classes and even in `__init__` methods. |
| 72 | + |
| 73 | +- **Multiple docstring-styles support:** common support for Google-style, Numpydoc-style, |
| 74 | + and Sphinx-style docstrings. |
| 75 | + |
| 76 | +- **Admonition support in Google docstrings:** blocks like `Note:` or `Warning:` will be transformed |
| 77 | + to their [admonition](https://squidfunk.github.io/mkdocs-material/reference/admonitions/) equivalent. |
| 78 | + *We do not support nested admonitions in docstrings!* |
| 79 | + |
| 80 | +- **Every object has a TOC entry:** we render a heading for each object, meaning *MkDocs* picks them into the Table |
| 81 | + of Contents, which is nicely display by the Material theme. Thanks to *mkdocstrings* cross-reference ability, |
| 82 | + you can reference other objects within your docstrings, with the classic Markdown syntax: |
| 83 | + `[this object][package.module.object]` or directly with `[package.module.object][]` |
| 84 | + |
| 85 | +- **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code |
| 86 | + of the Python object. |
0 commit comments