|
| 1 | +--- |
| 2 | +icon: lucide/boxes |
| 3 | +--- |
| 4 | + |
| 5 | +# mkdocstrings |
| 6 | + |
| 7 | +As of [0.0.11], Zensical provides preliminary support for [mkdocstrings], |
| 8 | +which allows rendering API reference documentation from source code. We'll be |
| 9 | +rethinking [API reference documentation] from the ground up in the coming |
| 10 | +months, making it much more flexible and powerful. |
| 11 | + |
| 12 | +!!! warning "Preliminary support" |
| 13 | + |
| 14 | + The mkdocstrings integration is preliminary, which means some features are |
| 15 | + not yet supported, specifically cross-references and backlinks. We're |
| 16 | + working on bringing these features into Zensical. |
| 17 | + |
| 18 | + [mkdocstrings]: https://mkdocstrings.github.io |
| 19 | + [0.0.11]: https://github.com/zensical/zensical/releases/tag/0.0.11 |
| 20 | + [API reference documentation]: https://zensical.org/about/roadmap/#api-documentation |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +[mkdocstrings] is not included with Zensical by default, so it needs to be |
| 25 | +installed separately: |
| 26 | + |
| 27 | +=== "with `pip`" |
| 28 | + |
| 29 | + ``` |
| 30 | + pip install mkdocstrings-python |
| 31 | + ``` |
| 32 | + |
| 33 | +=== "with `uv`" |
| 34 | + |
| 35 | + ``` |
| 36 | + uv add mkdocstrings-python |
| 37 | + ``` |
| 38 | + |
| 39 | +## Configuration |
| 40 | + |
| 41 | +Configure mkdocstrings as a plugin: |
| 42 | + |
| 43 | +=== "`zensical.toml`" |
| 44 | + |
| 45 | + ``` toml |
| 46 | + [project.plugins.mkdocstrings.handlers.python] |
| 47 | + inventories = ["https://docs.python.org/3/objects.inv"] |
| 48 | + paths = ["src"] |
| 49 | + |
| 50 | + [project.plugins.mkdocstrings.handlers.python.options] |
| 51 | + docstring_style = "google" |
| 52 | + inherited_members = true |
| 53 | + show_source = false |
| 54 | + ``` |
| 55 | + |
| 56 | +=== "`mkdocs.yml`" |
| 57 | + |
| 58 | + ``` yaml |
| 59 | + plugins: |
| 60 | + - mkdocstrings: |
| 61 | + handlers: |
| 62 | + python: |
| 63 | + paths: [src] |
| 64 | + inventories: |
| 65 | + - https://docs.python.org/3/objects.inv |
| 66 | + options: |
| 67 | + docstring_style: google |
| 68 | + inherited_members: true |
| 69 | + show_source: false |
| 70 | + ``` |
| 71 | + |
| 72 | +The complete list of options can be found here: |
| 73 | + |
| 74 | +- [mkdocstrings documentation] |
| 75 | +- [mkdocstrings Python handler documentation]. |
| 76 | + |
| 77 | + [mkdocstrings documentation]: https://mkdocstrings.github.io/usage/ |
| 78 | + [mkdocstrings Python handler documentation]: https://mkdocstrings.github.io/python/usage/ |
0 commit comments