| 1 |
# mkdocstrings |
| 2 |
|
| 3 |
[](https://github.com/mkdocstrings/mkdocstrings/actions?query=workflow%3Aci) |
| 4 |
[](https://mkdocstrings.github.io/mkdocstrings/) |
| 5 |
[](https://pypi.org/project/mkdocstrings/) |
| 6 |
[](https://anaconda.org/conda-forge/mkdocstrings) |
| 7 |
[](https://app.gitter.im/#/room/#mkdocstrings:gitter.im) |
| 8 |
|
| 9 |
Automatic documentation from sources, for [MkDocs](https://www.mkdocs.org/). |
| 10 |
Come have a chat or ask questions on our [Gitter channel](https://gitter.im/mkdocstrings/community). |
| 11 |
|
| 12 |
--- |
| 13 |
|
| 14 |
**[Features](#features)** - **[Installation](#installation)** - **[Quick usage](#quick-usage)** |
| 15 |
|
| 16 |
 |
| 17 |
|
| 18 |
## Features |
| 19 |
|
| 20 |
- [**Language-agnostic:**](https://mkdocstrings.github.io/handlers/overview/) |
| 21 |
just like *MkDocs*, *mkdocstrings* is written in Python but is language-agnostic. |
| 22 |
It means you can use it with any programming language, as long as there is a |
| 23 |
[**handler**](https://mkdocstrings.github.io/reference/api/#mkdocstrings.BaseHandler) for it. |
| 24 |
We currently have [handlers](https://mkdocstrings.github.io/handlers/overview/) for the |
| 25 |
[C](https://mkdocstrings.github.io/c/), |
| 26 |
[Crystal](https://mkdocstrings.github.io/crystal/), |
| 27 |
[GitHub Actions](https://watermarkhu.nl/mkdocstrings-github/), |
| 28 |
[Python](https://mkdocstrings.github.io/python/), |
| 29 |
[MATLAB](https://watermarkhu.nl/mkdocstrings-matlab/), |
| 30 |
[TypeScript](https://mkdocstrings.github.io/typescript/), and |
| 31 |
[VBA](https://pypi.org/project/mkdocstrings-vba/) languages, |
| 32 |
as well as for [shell scripts/libraries](https://mkdocstrings.github.io/shell/). |
| 33 |
Maybe you'd like to add another one to the list? :wink: |
| 34 |
|
| 35 |
- [**Multiple themes support:**](https://mkdocstrings.github.io/theming/) |
| 36 |
each handler can offer multiple themes. Currently, we offer the |
| 37 |
:star: [Material theme](https://squidfunk.github.io/mkdocs-material/) :star: |
| 38 |
as well as basic support for the ReadTheDocs and MkDocs themes for the Python handler. |
| 39 |
|
| 40 |
- [**Cross-references across pages:**](https://mkdocstrings.github.io/usage/#cross-references) |
| 41 |
*mkdocstrings* makes it possible to reference headings in other Markdown files with the classic Markdown linking |
| 42 |
syntax: `[identifier][]` or `[title][identifier]` -- and you don't need to remember which exact page this object was |
| 43 |
on. This works for any heading that's produced by a *mkdocstrings* language handler, and you can opt to include |
| 44 |
*any* Markdown heading into the global referencing scheme. |
| 45 |
|
| 46 |
**Note**: in versions prior to 0.15 *all* Markdown headers were included, but now you need to |
| 47 |
[opt in](https://mkdocstrings.github.io/usage/#cross-references-to-any-markdown-heading). |
| 48 |
|
| 49 |
- [**Cross-references across sites:**](https://mkdocstrings.github.io/usage/#cross-references-to-other-projects-inventories) |
| 50 |
similarly to [Sphinx's intersphinx extension](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html), |
| 51 |
*mkdocstrings* can reference API items from other libraries, given they provide an inventory and you load |
| 52 |
that inventory in your MkDocs configuration. |
| 53 |
|
| 54 |
- [**Inline injection in Markdown:**](https://mkdocstrings.github.io/usage/) |
| 55 |
instead of generating Markdown files, *mkdocstrings* allows you to inject |
| 56 |
documentation anywhere in your Markdown contents. The syntax is simple: `::: identifier` followed by a 4-spaces |
| 57 |
indented YAML block. The identifier and YAML configuration will be passed to the appropriate handler |
| 58 |
to collect and render documentation. |
| 59 |
|
| 60 |
- [**Global and local configuration:**](https://mkdocstrings.github.io/usage/#global-options) |
| 61 |
each handler can be configured globally in `mkdocs.yml`, and locally for each |
| 62 |
"autodoc" instruction. |
| 63 |
|
| 64 |
- **Reasonable defaults:** |
| 65 |
you should be able to just drop the plugin in your configuration and enjoy your auto-generated docs. |
| 66 |
|
| 67 |
## Used by |
| 68 |
|
| 69 |
*mkdocstrings* is used by well-known companies, projects and scientific teams: |
| 70 |
[Ansible](https://molecule.readthedocs.io/configuration/), |
| 71 |
[Apache](https://streampipes.apache.org/docs/docs/python/latest/reference/client/client/), |
| 72 |
[FastAPI](https://fastapi.tiangolo.com/reference/fastapi/), |
| 73 |
[Google](https://docs.kidger.site/jaxtyping/api/runtime-type-checking/), |
| 74 |
[IBM](https://ds4sd.github.io/docling/api_reference/document_converter/), |
| 75 |
[Jitsi](https://jitsi.github.io/jiwer/reference/alignment/), |
| 76 |
[Microsoft](https://microsoft.github.io/presidio/api/analyzer_python/), |
| 77 |
[NVIDIA](https://nvidia.github.io/bionemo-framework/main/references/API_reference/bionemo/core/api/), |
| 78 |
[Prefect](https://docs.prefect.io/2.10.12/api-ref/prefect/agent/), |
| 79 |
[Pydantic](https://docs.pydantic.dev/dev-v2/api/main/), |
| 80 |
[Textual](https://textual.textualize.io/api/app/), |
| 81 |
[and more...](https://github.com/mkdocstrings/mkdocstrings/network/dependents) |
| 82 |
|
| 83 |
## Installation |
| 84 |
|
| 85 |
The `mkdocstrings` package doesn't provide support for any language: it's just a common base for language handlers. |
| 86 |
It means you likely want to install it with one or more official handlers, using [extras](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#extras). |
| 87 |
For example, to install it with Python support: |
| 88 |
|
| 89 |
```bash |
| 90 |
pip install 'mkdocstrings[python]' |
| 91 |
``` |
| 92 |
|
| 93 |
Alternatively, you can directly install the language handlers themselves, |
| 94 |
which depend on `mkdocstrings` anyway: |
| 95 |
|
| 96 |
```bash |
| 97 |
pip install mkdocstrings-python |
| 98 |
``` |
| 99 |
|
| 100 |
This will give you more control over the accepted range of versions for the handlers themselves. |
| 101 |
|
| 102 |
See the [official language handlers](https://mkdocstrings.github.io/handlers/overview/). |
| 103 |
|
| 104 |
--- |
| 105 |
|
| 106 |
With `conda`: |
| 107 |
|
| 108 |
```bash |
| 109 |
conda install -c conda-forge mkdocstrings mkdocstrings-python |
| 110 |
``` |
| 111 |
|
| 112 |
## Quick usage |
| 113 |
|
| 114 |
In `mkdocs.yml`: |
| 115 |
|
| 116 |
```yaml |
| 117 |
site_name: "My Library" |
| 118 |
|
| 119 |
theme: |
| 120 |
name: "material" |
| 121 |
|
| 122 |
plugins: |
| 123 |
- search |
| 124 |
- mkdocstrings |
| 125 |
``` |
| 126 |
|
| 127 |
In one of your markdown files: |
| 128 |
|
| 129 |
```markdown |
| 130 |
# Reference |
| 131 |
|
| 132 |
::: my_library.my_module.my_class |
| 133 |
``` |
| 134 |
|
| 135 |
See the [Usage](https://mkdocstrings.github.io/usage) section of the docs for more examples! |
| 136 |
|
| 137 |
## Sponsors |
| 138 |
|
| 139 |
<!-- sponsors-start --> |
| 140 |
|
| 141 |
<div id="premium-sponsors" style="text-align: center;"> |
| 142 |
|
| 143 |
<div id="silver-sponsors"><b>Silver sponsors</b><p> |
| 144 |
<a href="https://fastapi.tiangolo.com/"><img alt="FastAPI" src="https://raw.githubusercontent.com/tiangolo/fastapi/master/docs/en/docs/img/logo-margin/logo-teal.png" style="height: 200px; "></a><br> |
| 145 |
</p></div> |
| 146 |
|
| 147 |
<div id="bronze-sponsors"><b>Bronze sponsors</b><p> |
| 148 |
<a href="https://www.nixtla.io/"><picture><source media="(prefers-color-scheme: light)" srcset="https://www.nixtla.io/img/logo/full-black.svg"><source media="(prefers-color-scheme: dark)" srcset="https://www.nixtla.io/img/logo/full-white.svg"><img alt="Nixtla" src="https://www.nixtla.io/img/logo/full-black.svg" style="height: 60px; "></picture></a><br> |
| 149 |
</p></div> |
| 150 |
</div> |
| 151 |
|
| 152 |
--- |
| 153 |
|
| 154 |
<div id="sponsors"><p> |
| 155 |
<a href="https://github.com/ofek"><img alt="ofek" src="https://avatars.githubusercontent.com/u/9677399?u=386c330f212ce467ce7119d9615c75d0e9b9f1ce&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 156 |
<a href="https://github.com/samuelcolvin"><img alt="samuelcolvin" src="https://avatars.githubusercontent.com/u/4039449?u=42eb3b833047c8c4b4f647a031eaef148c16d93f&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 157 |
<a href="https://github.com/tlambert03"><img alt="tlambert03" src="https://avatars.githubusercontent.com/u/1609449?u=922abf0524b47739b37095e553c99488814b05db&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 158 |
<a href="https://github.com/ssbarnea"><img alt="ssbarnea" src="https://avatars.githubusercontent.com/u/102495?u=c7bd9ddf127785286fc939dd18cb02db0a453bce&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 159 |
<a href="https://github.com/femtomc"><img alt="femtomc" src="https://avatars.githubusercontent.com/u/34410036?u=f13a71daf2a9f0d2da189beaa94250daa629e2d8&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 160 |
<a href="https://github.com/cmarqu"><img alt="cmarqu" src="https://avatars.githubusercontent.com/u/360986?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 161 |
<a href="https://github.com/kolenaIO"><img alt="kolenaIO" src="https://avatars.githubusercontent.com/u/77010818?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 162 |
<a href="https://github.com/ramnes"><img alt="ramnes" src="https://avatars.githubusercontent.com/u/835072?u=3fca03c3ba0051e2eb652b1def2188a94d1e1dc2&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 163 |
<a href="https://github.com/machow"><img alt="machow" src="https://avatars.githubusercontent.com/u/2574498?u=c41e3d2f758a05102d8075e38d67b9c17d4189d7&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 164 |
<a href="https://github.com/BenHammersley"><img alt="BenHammersley" src="https://avatars.githubusercontent.com/u/99436?u=4499a7b507541045222ee28ae122dbe3c8d08ab5&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 165 |
<a href="https://github.com/trevorWieland"><img alt="trevorWieland" src="https://avatars.githubusercontent.com/u/28811461?u=74cc0e3756c1d4e3d66b5c396e1d131ea8a10472&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 166 |
<a href="https://github.com/MarcoGorelli"><img alt="MarcoGorelli" src="https://avatars.githubusercontent.com/u/33491632?u=7de3a749cac76a60baca9777baf71d043a4f884d&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 167 |
<a href="https://github.com/analog-cbarber"><img alt="analog-cbarber" src="https://avatars.githubusercontent.com/u/7408243?u=fe0e7bf2882d1c9c901a341c2502e1518466527a&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 168 |
<a href="https://github.com/OdinManiac"><img alt="OdinManiac" src="https://avatars.githubusercontent.com/u/22727172?u=36ab20970f7f52ae8e7eb67b7fcf491fee01ac22&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 169 |
<a href="https://github.com/rstudio-sponsorship"><img alt="rstudio-sponsorship" src="https://avatars.githubusercontent.com/u/58949051?u=0c471515dd18111be30dfb7669ed5e778970959b&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 170 |
<a href="https://github.com/schlich"><img alt="schlich" src="https://avatars.githubusercontent.com/u/21191435?u=6f1240adb68f21614d809ae52d66509f46b1e877&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 171 |
<a href="https://github.com/butterlyn"><img alt="butterlyn" src="https://avatars.githubusercontent.com/u/53323535?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 172 |
<a href="https://github.com/livingbio"><img alt="livingbio" src="https://avatars.githubusercontent.com/u/10329983?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 173 |
<a href="https://github.com/NemetschekAllplan"><img alt="NemetschekAllplan" src="https://avatars.githubusercontent.com/u/912034?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 174 |
<a href="https://github.com/EricJayHartman"><img alt="EricJayHartman" src="https://avatars.githubusercontent.com/u/9259499?u=7e58cc7ec0cd3e85b27aec33656aa0f6612706dd&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 175 |
<a href="https://github.com/15r10nk"><img alt="15r10nk" src="https://avatars.githubusercontent.com/u/44680962?u=f04826446ff165742efa81e314bd03bf1724d50e&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 176 |
<a href="https://github.com/activeloopai"><img alt="activeloopai" src="https://avatars.githubusercontent.com/u/34816118?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 177 |
<a href="https://github.com/roboflow"><img alt="roboflow" src="https://avatars.githubusercontent.com/u/53104118?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 178 |
<a href="https://github.com/cmclaughlin"><img alt="cmclaughlin" src="https://avatars.githubusercontent.com/u/1061109?u=ddf6eec0edd2d11c980f8c3aa96e3d044d4e0468&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 179 |
<a href="https://github.com/RapidataAI"><img alt="RapidataAI" src="https://avatars.githubusercontent.com/u/104209891?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 180 |
<a href="https://github.com/rodolphebarbanneau"><img alt="rodolphebarbanneau" src="https://avatars.githubusercontent.com/u/46493454?u=6c405452a40c231cdf0b68e97544e07ee956a733&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 181 |
<a href="https://github.com/theSymbolSyndicate"><img alt="theSymbolSyndicate" src="https://avatars.githubusercontent.com/u/111542255?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 182 |
<a href="https://github.com/blakeNaccarato"><img alt="blakeNaccarato" src="https://avatars.githubusercontent.com/u/20692450?u=bb919218be30cfa994514f4cf39bb2f7cf952df4&v=4" style="height: 32px; border-radius: 100%;"></a> |
| 183 |
<a href="https://github.com/ChargeStorm"><img alt="ChargeStorm" src="https://avatars.githubusercontent.com/u/26000165?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 184 |
<a href="https://github.com/Cusp-AI"><img alt="Cusp-AI" src="https://avatars.githubusercontent.com/u/178170649?v=4" style="height: 32px; border-radius: 100%;"></a> |
| 185 |
</p></div> |
| 186 |
|
| 187 |
|
| 188 |
*And 4 more private sponsor(s).* |
| 189 |
|
| 190 |
<!-- sponsors-end --> |