| 1 |
# Headings options |
| 2 |
|
| 3 |
[](){#option-heading} |
| 4 |
## `heading` |
| 5 |
|
| 6 |
- **:octicons-package-24: Type [`str`][] :material-equal: `""`{ title="default value" }** |
| 7 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 8 |
|
| 9 |
A custom string to use as the heading of the root object (i.e. the object specified directly after the identifier `:::`). This will override the default heading generated by the plugin. See also the [`toc_label` option][option-toc_label]. |
| 10 |
|
| 11 |
WARNING: **Not advised to be used as a global configuration option.** This option is not advised to be used as a global configuration option, as it will override the default heading for all objects. It is recommended to use it only in specific cases where you want to override the heading for a specific object. |
| 12 |
|
| 13 |
```md title="in docs/some_page.md (local configuration)" |
| 14 |
::: path.to.module |
| 15 |
options: |
| 16 |
heading: "My fancy module" |
| 17 |
``` |
| 18 |
|
| 19 |
[](){#option-heading_level} |
| 20 |
## `heading_level` |
| 21 |
|
| 22 |
- **:octicons-package-24: Type [`int`][] :material-equal: `2`{ title="default value" }** |
| 23 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 24 |
|
| 25 |
The initial heading level to use. |
| 26 |
|
| 27 |
When injecting documentation for an object, |
| 28 |
the object itself and its members are rendered. |
| 29 |
For each layer of objects, we increase the heading level by 1. |
| 30 |
|
| 31 |
The initial heading level will be used for the first layer. |
| 32 |
If you set it to 3, then headings will start with `<h3>`. |
| 33 |
|
| 34 |
If the [heading for the root object][show_root_heading] is not shown, |
| 35 |
then the initial heading level is used for its members. |
| 36 |
|
| 37 |
```yaml title="in mkdocs.yml (global configuration)" |
| 38 |
plugins: |
| 39 |
- mkdocstrings: |
| 40 |
handlers: |
| 41 |
python: |
| 42 |
options: |
| 43 |
heading_level: 2 |
| 44 |
``` |
| 45 |
|
| 46 |
```md title="or in docs/some_page.md (local configuration)" |
| 47 |
::: path.to.module |
| 48 |
options: |
| 49 |
heading_level: 3 |
| 50 |
``` |
| 51 |
|
| 52 |
/// admonition | Preview |
| 53 |
type: preview |
| 54 |
|
| 55 |
//// tab | With level 3 and root heading |
| 56 |
<h3><code>module</code> (3)</h3> |
| 57 |
<p>Docstring of the module.</p> |
| 58 |
<h4><code>ClassA</code> (4)</h4> |
| 59 |
<p>Docstring of class A.</p> |
| 60 |
<h4><code>ClassB</code> (4)</h4> |
| 61 |
<p>Docstring of class B.</p> |
| 62 |
<h5><code>method_1</code> (5)</h5> |
| 63 |
<p>Docstring of the method.</p> |
| 64 |
//// |
| 65 |
|
| 66 |
//// tab | With level 3, without root heading |
| 67 |
<p>Docstring of the module.</p> |
| 68 |
<h3><code>ClassA</code> (3)</h3> |
| 69 |
<p>Docstring of class A.</p> |
| 70 |
<h3><code>ClassB</code> (3)</h3> |
| 71 |
<p>Docstring of class B.</p> |
| 72 |
<h4><code>method_1</code> (4)</h4> |
| 73 |
<p>Docstring of the method.</p> |
| 74 |
//// |
| 75 |
/// |
| 76 |
|
| 77 |
[](){#option-parameter_headings} |
| 78 |
## `parameter_headings` |
| 79 |
|
| 80 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 81 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 82 |
|
| 83 |
Whether to render headings for function/method parameters. |
| 84 |
|
| 85 |
With this option enabled, each function/method parameter |
| 86 |
(including parameters of `__init__` methods merged in their parent class |
| 87 |
with the [`merge_init_into_class`][] option) |
| 88 |
gets a permalink, an entry in the Table of Contents, |
| 89 |
and an entry in the generated objects inventory (unless [`skip_local_inventory`][] is enabled). |
| 90 |
The permalink and inventory entry allow cross-references |
| 91 |
from internal and external pages. |
| 92 |
|
| 93 |
The identifier used in the permalink and inventory is of the following form: |
| 94 |
`path.to.function(param_name)`. To manually cross-reference a parameter, |
| 95 |
you can therefore use this Markdown syntax: |
| 96 |
|
| 97 |
```md |
| 98 |
- Class parameter: [`param`][package.module.Class(param)] |
| 99 |
- Method parameter: [`param`][package.module.Class.method(param)] |
| 100 |
- Function parameter: [`param`][package.module.function(param)] |
| 101 |
- Variadic positional parameters: [`*args`][package.module.function(*args)] |
| 102 |
- Variadic keyword parameters: [`**kwargs`][package.module.function(**kwargs)] |
| 103 |
``` |
| 104 |
|
| 105 |
Enabling this option along with [`signature_crossrefs`][] will automatically |
| 106 |
render cross-references to parameters in class/function/method signatures |
| 107 |
and attributes values. |
| 108 |
|
| 109 |
```yaml title="in mkdocs.yml (global configuration)" |
| 110 |
plugins: |
| 111 |
- mkdocstrings: |
| 112 |
handlers: |
| 113 |
python: |
| 114 |
options: |
| 115 |
parameter_headings: false |
| 116 |
``` |
| 117 |
|
| 118 |
```md title="or in docs/some_page.md (local configuration)" |
| 119 |
::: path.to.module |
| 120 |
options: |
| 121 |
parameter_headings: true |
| 122 |
``` |
| 123 |
|
| 124 |
/// admonition | Preview: Cross-references |
| 125 |
type: preview |
| 126 |
|
| 127 |
```md exec="on" |
| 128 |
::: package.get_version |
| 129 |
options: |
| 130 |
heading_level: 3 |
| 131 |
parameter_headings: true |
| 132 |
docstring_section_style: list |
| 133 |
|
| 134 |
::: package.current_version |
| 135 |
options: |
| 136 |
heading_level: 3 |
| 137 |
line_length: 100 |
| 138 |
``` |
| 139 |
|
| 140 |
/// |
| 141 |
|
| 142 |
/// admonition | Preview: Parameter sections |
| 143 |
type: preview |
| 144 |
|
| 145 |
//// tab | Table style |
| 146 |
```md exec="on" |
| 147 |
::: package.get_version |
| 148 |
options: |
| 149 |
heading_level: 3 |
| 150 |
show_root_heading: false |
| 151 |
show_root_toc_entry: false |
| 152 |
parameter_headings: true |
| 153 |
docstring_section_style: table |
| 154 |
show_docstring_returns: false |
| 155 |
show_docstring_description: false |
| 156 |
``` |
| 157 |
//// |
| 158 |
|
| 159 |
//// tab | List style |
| 160 |
```md exec="on" |
| 161 |
::: package.get_version |
| 162 |
options: |
| 163 |
heading_level: 3 |
| 164 |
show_root_heading: false |
| 165 |
show_root_toc_entry: false |
| 166 |
parameter_headings: true |
| 167 |
docstring_section_style: list |
| 168 |
show_docstring_returns: false |
| 169 |
show_docstring_description: false |
| 170 |
``` |
| 171 |
//// |
| 172 |
|
| 173 |
//// tab | Spacy style |
| 174 |
```md exec="on" |
| 175 |
::: package.get_version |
| 176 |
options: |
| 177 |
heading_level: 3 |
| 178 |
show_root_heading: false |
| 179 |
show_root_toc_entry: false |
| 180 |
parameter_headings: true |
| 181 |
docstring_section_style: spacy |
| 182 |
show_docstring_returns: false |
| 183 |
show_docstring_description: false |
| 184 |
``` |
| 185 |
//// |
| 186 |
/// |
| 187 |
|
| 188 |
/// admonition | Preview: Table of contents (with symbol types) |
| 189 |
type: preview |
| 190 |
|
| 191 |
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code> get_version<br> |
| 192 |
<code class="doc-symbol doc-symbol-toc doc-symbol-parameter" style="margin-left: 16px;"></code> dist |
| 193 |
|
| 194 |
To customize symbols, see [Customizing symbol types](../customization.md#symbol-types). |
| 195 |
|
| 196 |
/// |
| 197 |
|
| 198 |
[](){#option-show_root_heading} |
| 199 |
## `show_root_heading` |
| 200 |
|
| 201 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 202 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 203 |
|
| 204 |
Show the heading of the object at the root of the documentation tree |
| 205 |
(i.e. the object referenced by the identifier after `:::`). |
| 206 |
|
| 207 |
It is pretty common to inject documentation for one module per page, |
| 208 |
especially when following our [automatic reference pages recipe][autopages recipe]. |
| 209 |
Since each page already has a title, usually being the module's name, |
| 210 |
we can spare one heading level by not showing the heading for the module itself |
| 211 |
(heading levels are limited to 6 by the HTML specification). |
| 212 |
|
| 213 |
Sparing that extra level can be helpful when your objects tree is deeply nested |
| 214 |
(e.g. method in a class in a class in a module). |
| 215 |
If your objects tree is not deeply nested, and you are injecting documentation |
| 216 |
for many different objects on a single page, it might be preferable to render |
| 217 |
the heading of each object. |
| 218 |
|
| 219 |
```yaml title="in mkdocs.yml (global configuration)" |
| 220 |
plugins: |
| 221 |
- mkdocstrings: |
| 222 |
handlers: |
| 223 |
python: |
| 224 |
options: |
| 225 |
show_root_heading: false |
| 226 |
``` |
| 227 |
|
| 228 |
```md title="or in docs/some_page.md (local configuration)" |
| 229 |
::: path.to.ClassA |
| 230 |
options: |
| 231 |
show_root_heading: true |
| 232 |
|
| 233 |
::: path.to.ClassB |
| 234 |
options: |
| 235 |
show_root_heading: true |
| 236 |
``` |
| 237 |
|
| 238 |
/// admonition | Preview |
| 239 |
type: preview |
| 240 |
|
| 241 |
//// tab | With root heading |
| 242 |
<h2><code>ClassA</code> (2)</h2> |
| 243 |
<p>Docstring of class A.</p> |
| 244 |
<h3><code>method_a1</code> (3)</h3> |
| 245 |
<p>Docstring of the method.</p> |
| 246 |
<h2><code>ClassB</code> (2)</h2> |
| 247 |
<p>Docstring of class B.</p> |
| 248 |
<h3><code>method_b1</code> (3)</h3> |
| 249 |
<p>Docstring of the method.</p> |
| 250 |
//// |
| 251 |
|
| 252 |
//// tab | Without root heading |
| 253 |
<p>Docstring of class A.</p> |
| 254 |
<h2><code>method_a1</code> (2)</h2> |
| 255 |
<p>Docstring of the method.</p> |
| 256 |
<p>Docstring of class B.</p> |
| 257 |
<h2><code>method_b1</code> (2)</h2> |
| 258 |
<p>Docstring of the method.</p> |
| 259 |
//// |
| 260 |
/// |
| 261 |
|
| 262 |
[](){#option-show_root_toc_entry} |
| 263 |
## `show_root_toc_entry` |
| 264 |
|
| 265 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** |
| 266 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 267 |
|
| 268 |
If the root heading is not shown, at least add a ToC entry for it. |
| 269 |
|
| 270 |
If you inject documentation for an object in the middle of a page, |
| 271 |
after long paragraphs, and without showing the [root heading][show_root_heading], |
| 272 |
then you will not be able to link to this particular object |
| 273 |
as it won't have a permalink and will be "lost" in the middle of text. |
| 274 |
In that case, it is useful to add a hidden anchor to the document, |
| 275 |
which will also appear in the table of contents. |
| 276 |
|
| 277 |
In other cases, you might want to disable the entry to avoid polluting the ToC. |
| 278 |
It is not possible to show the root heading *and* hide the ToC entry. |
| 279 |
|
| 280 |
```yaml title="in mkdocs.yml (global configuration)" |
| 281 |
plugins: |
| 282 |
- mkdocstrings: |
| 283 |
handlers: |
| 284 |
python: |
| 285 |
options: |
| 286 |
show_root_toc_entry: true |
| 287 |
``` |
| 288 |
|
| 289 |
```md title="or in docs/some_page.md (local configuration)" |
| 290 |
## Some heading |
| 291 |
|
| 292 |
Lots of text. |
| 293 |
|
| 294 |
::: path.to.object |
| 295 |
options: |
| 296 |
show_root_toc_entry: false |
| 297 |
|
| 298 |
## Other heading. |
| 299 |
|
| 300 |
More text. |
| 301 |
``` |
| 302 |
|
| 303 |
/// admonition | Preview |
| 304 |
type: preview |
| 305 |
|
| 306 |
[](){#permalink-to-some-heading} |
| 307 |
[](){#permalink-to-object} |
| 308 |
[](){#permalink-to-other-heading} |
| 309 |
|
| 310 |
//// tab | With ToC entry |
| 311 |
**Table of contents** |
| 312 |
[Some heading](#permalink-to-some-heading){ title="#permalink-to-some-heading" } |
| 313 |
[`object`](#permalink-to-object){ title="#permalink-to-object" } |
| 314 |
[Other heading](#permalink-to-other-heading){ title="#permalink-to-other-heading" } |
| 315 |
//// |
| 316 |
|
| 317 |
//// tab | Without ToC entry |
| 318 |
**Table of contents** |
| 319 |
[Some heading](#permalink-to-some-heading){ title="#permalink-to-some-heading" } |
| 320 |
[Other heading](#permalink-to-other-heading){ title="#permalink-to-other-heading" } |
| 321 |
//// |
| 322 |
/// |
| 323 |
|
| 324 |
[](){#option-show_root_full_path} |
| 325 |
## `show_root_full_path` |
| 326 |
|
| 327 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** |
| 328 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 329 |
|
| 330 |
Show the full Python path for the root object heading. |
| 331 |
|
| 332 |
The path of a Python object is the dot-separated list of names |
| 333 |
under which it is accessible, for example `package.module.Class.method`. |
| 334 |
|
| 335 |
With this option you can choose to show the full path of the object |
| 336 |
you inject documentation for, or just its name. This option impacts |
| 337 |
only the object you specify, not its members. For members, see the two |
| 338 |
other options [`show_root_members_full_path`][] |
| 339 |
and [`show_object_full_path`][]. |
| 340 |
|
| 341 |
```yaml title="in mkdocs.yml (global configuration)" |
| 342 |
plugins: |
| 343 |
- mkdocstrings: |
| 344 |
handlers: |
| 345 |
python: |
| 346 |
options: |
| 347 |
show_root_full_path: true |
| 348 |
``` |
| 349 |
|
| 350 |
```md title="or in docs/some_page.md (local configuration)" |
| 351 |
::: package.module.Class.method |
| 352 |
options: |
| 353 |
show_root_full_path: false |
| 354 |
``` |
| 355 |
|
| 356 |
/// admonition | Preview |
| 357 |
type: preview |
| 358 |
|
| 359 |
//// tab | With root full path |
| 360 |
<h2><code>package.module.Class.method</code></h2> |
| 361 |
<p>Docstring of the method.</p> |
| 362 |
//// |
| 363 |
|
| 364 |
//// tab | Without root full path |
| 365 |
<h2><code>method</code></h2> |
| 366 |
<p>Docstring of the method.</p> |
| 367 |
//// |
| 368 |
/// |
| 369 |
|
| 370 |
[](){#option-show_root_members_full_path} |
| 371 |
## `show_root_members_full_path` |
| 372 |
|
| 373 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 374 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 375 |
|
| 376 |
Show the full Python path of the root members. |
| 377 |
|
| 378 |
This option does the same thing as [`show_root_full_path`][], |
| 379 |
but for direct members of the root object instead of the root object itself. |
| 380 |
|
| 381 |
To show the full path for every member recursively, |
| 382 |
see [`show_object_full_path`][]. |
| 383 |
|
| 384 |
```yaml title="in mkdocs.yml (global configuration)" |
| 385 |
plugins: |
| 386 |
- mkdocstrings: |
| 387 |
handlers: |
| 388 |
python: |
| 389 |
options: |
| 390 |
show_root_members_full_path: true |
| 391 |
``` |
| 392 |
|
| 393 |
```md title="or in docs/some_page.md (local configuration)" |
| 394 |
::: package.module |
| 395 |
options: |
| 396 |
show_root_members_full_path: false |
| 397 |
``` |
| 398 |
|
| 399 |
/// admonition | Preview |
| 400 |
type: preview |
| 401 |
|
| 402 |
//// tab | With members full path |
| 403 |
<p>Docstring of the module.</p> |
| 404 |
<h2><code>package.module.Class</code></h2> |
| 405 |
<p>Docstring of the class.</p> |
| 406 |
<h3><code>method</code></h3> |
| 407 |
<p>Docstring of the method.</p> |
| 408 |
//// |
| 409 |
|
| 410 |
//// tab | Without members full path |
| 411 |
<p>Docstring of the module.</p> |
| 412 |
<h2><code>Class</code></h2> |
| 413 |
<p>Docstring of the class.</p> |
| 414 |
<h3><code>method</code></h3> |
| 415 |
<p>Docstring of the method.</p> |
| 416 |
//// |
| 417 |
/// |
| 418 |
|
| 419 |
[](){#option-show_object_full_path} |
| 420 |
## `show_object_full_path` |
| 421 |
|
| 422 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 423 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 424 |
|
| 425 |
Show the full Python path of every object. |
| 426 |
|
| 427 |
Same as for [`show_root_members_full_path`][], |
| 428 |
but for every member, recursively. This option takes precedence over |
| 429 |
[`show_root_members_full_path`][]: |
| 430 |
|
| 431 |
`show_root_members_full_path` | `show_object_full_path` | Direct root members path |
| 432 |
----------------------------- | ----------------------- | ------------------------ |
| 433 |
False | False | Name only |
| 434 |
False | True | Full |
| 435 |
True | False | Full |
| 436 |
True | True | Full |
| 437 |
|
| 438 |
```yaml title="in mkdocs.yml (global configuration)" |
| 439 |
plugins: |
| 440 |
- mkdocstrings: |
| 441 |
handlers: |
| 442 |
python: |
| 443 |
options: |
| 444 |
show_object_full_path: true |
| 445 |
``` |
| 446 |
|
| 447 |
```md title="or in docs/some_page.md (local configuration)" |
| 448 |
::: package.module |
| 449 |
options: |
| 450 |
show_object_full_path: false |
| 451 |
``` |
| 452 |
|
| 453 |
/// admonition | Preview |
| 454 |
type: preview |
| 455 |
|
| 456 |
//// tab | With objects full path |
| 457 |
<p>Docstring of the module.</p> |
| 458 |
<h2><code>package.module.Class</code></h2> |
| 459 |
<p>Docstring of the class.</p> |
| 460 |
<h3><code>package.module.Class.method</code></h3> |
| 461 |
<p>Docstring of the method.</p> |
| 462 |
//// |
| 463 |
|
| 464 |
//// tab | Without objects full path |
| 465 |
<p>Docstring of the module.</p> |
| 466 |
<h2><code>Class</code></h2> |
| 467 |
<p>Docstring of the class.</p> |
| 468 |
<h3><code>method</code></h3> |
| 469 |
<p>Docstring of the method.</p> |
| 470 |
//// |
| 471 |
/// |
| 472 |
|
| 473 |
[](){#option-show_category_heading} |
| 474 |
## `show_category_heading` |
| 475 |
|
| 476 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 477 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 478 |
|
| 479 |
When [grouped by categories][group_by_category], show a heading for each category. |
| 480 |
These category headings will appear in the table of contents, |
| 481 |
allowing you to link to them using their permalinks. |
| 482 |
|
| 483 |
WARNING: **Not recommended with deeply nested objects.** |
| 484 |
When injecting documentation for deeply nested objects, |
| 485 |
you'll quickly run out of heading levels, and the objects |
| 486 |
at the bottom of the tree risk all getting documented |
| 487 |
using H6 headings, which might decrease the readability |
| 488 |
of your API docs. |
| 489 |
|
| 490 |
```yaml title="in mkdocs.yml (global configuration)" |
| 491 |
plugins: |
| 492 |
- mkdocstrings: |
| 493 |
handlers: |
| 494 |
python: |
| 495 |
options: |
| 496 |
group_by_category: true |
| 497 |
show_category_heading: true |
| 498 |
``` |
| 499 |
|
| 500 |
```md title="or in docs/some_page.md (local configuration)" |
| 501 |
::: package.module |
| 502 |
options: |
| 503 |
group_by_category: true |
| 504 |
show_category_heading: false |
| 505 |
``` |
| 506 |
|
| 507 |
/// admonition | Preview |
| 508 |
type: preview |
| 509 |
|
| 510 |
//// tab | With category headings |
| 511 |
<p>Docstring of the module.</p> |
| 512 |
<h2>Attributes (2)</h2> |
| 513 |
<h3><code>module_attribute</code> (3)</h3> |
| 514 |
<p>Docstring of the module attribute.</p> |
| 515 |
<h2>Classes (2)</h2> |
| 516 |
<h3><code>Class</code> (3)</h3> |
| 517 |
<p>Docstring of the class.</p> |
| 518 |
<h4>Attributes (4)</h4> |
| 519 |
<h5><code>class_attribute</code> (5)</h5> |
| 520 |
<p>Docstring of the class attribute.</p> |
| 521 |
<h4>Methods (4)</h4> |
| 522 |
<h5><code>method</code> (5)</h5> |
| 523 |
<p>Docstring of the method.</p> |
| 524 |
//// |
| 525 |
|
| 526 |
//// tab | Without category headings |
| 527 |
<p>Docstring of the module.</p> |
| 528 |
<h2><code>module_attribute</code> (2)</h2> |
| 529 |
<p>Docstring of the module attribute.</p> |
| 530 |
<h2><code>Class</code> (2)</h2> |
| 531 |
<p>Docstring of the class.</p> |
| 532 |
<h3><code>class_attribute</code> (3)</h3> |
| 533 |
<p>Docstring of the class attribute.</p> |
| 534 |
<h3><code>method</code> (3)</h3> |
| 535 |
<p>Docstring of the method.</p> |
| 536 |
//// |
| 537 |
/// |
| 538 |
|
| 539 |
[](){#option-show_symbol_type_heading} |
| 540 |
## `show_symbol_type_heading` |
| 541 |
|
| 542 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 543 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 544 |
|
| 545 |
Show the symbol type in headings. |
| 546 |
|
| 547 |
This option will prefix headings with |
| 548 |
<code class="doc-symbol doc-symbol-attribute"></code>, |
| 549 |
<code class="doc-symbol doc-symbol-function"></code>, |
| 550 |
<code class="doc-symbol doc-symbol-method"></code>, |
| 551 |
<code class="doc-symbol doc-symbol-class"></code> or |
| 552 |
<code class="doc-symbol doc-symbol-module"></code> types. |
| 553 |
See also [`show_symbol_type_toc`][show_symbol_type_toc]. |
| 554 |
|
| 555 |
To customize symbols, see [Customizing symbol types](../customization.md#symbol-types). |
| 556 |
|
| 557 |
```yaml title="in mkdocs.yml (global configuration)" |
| 558 |
plugins: |
| 559 |
- mkdocstrings: |
| 560 |
handlers: |
| 561 |
python: |
| 562 |
options: |
| 563 |
show_symbol_type_heading: true |
| 564 |
``` |
| 565 |
|
| 566 |
```md title="or in docs/some_page.md (local configuration)" |
| 567 |
::: package.module |
| 568 |
options: |
| 569 |
show_symbol_type_heading: false |
| 570 |
``` |
| 571 |
|
| 572 |
/// admonition | Preview |
| 573 |
type: preview |
| 574 |
|
| 575 |
//// tab | With symbol type in headings |
| 576 |
<h1><code class="doc-symbol doc-symbol-module"></code> <code>module</code></h1> |
| 577 |
<p>Docstring of the module.</p> |
| 578 |
<h2><code class="doc-symbol doc-symbol-attribute"></code> <code>attribute</code></h2> |
| 579 |
<p>Docstring of the module attribute.</p> |
| 580 |
<h2><code class="doc-symbol doc-symbol-function"></code> <code>function</code></h2> |
| 581 |
<p>Docstring of the function.</p> |
| 582 |
<h2><code class="doc-symbol doc-symbol-class"></code> <code>Class</code></h2> |
| 583 |
<p>Docstring of the class.</p> |
| 584 |
<h3><code class="doc-symbol doc-symbol-method"></code> <code>method</code></h3> |
| 585 |
<p>Docstring of the method.</p> |
| 586 |
//// |
| 587 |
|
| 588 |
//// tab | Without symbol type in headings |
| 589 |
<h1><code>module</code></h1> |
| 590 |
<p>Docstring of the module.</p> |
| 591 |
<h2><code>attribute</code></h2> |
| 592 |
<p>Docstring of the module attribute.</p> |
| 593 |
<h2><code>function</code></h2> |
| 594 |
<p>Docstring of the function.</p> |
| 595 |
<h2><code>Class</code></h2> |
| 596 |
<p>Docstring of the class.</p> |
| 597 |
<h3><code>method</code></h3> |
| 598 |
<p>Docstring of the method.</p> |
| 599 |
//// |
| 600 |
/// |
| 601 |
|
| 602 |
[](){#option-show_symbol_type_toc} |
| 603 |
## `show_symbol_type_toc` |
| 604 |
|
| 605 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 606 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 607 |
|
| 608 |
Show the symbol type in the Table of Contents. |
| 609 |
|
| 610 |
This option will prefix items in the ToC with |
| 611 |
<code class="doc-symbol doc-symbol-attribute"></code>, |
| 612 |
<code class="doc-symbol doc-symbol-function"></code>, |
| 613 |
<code class="doc-symbol doc-symbol-method"></code>, |
| 614 |
<code class="doc-symbol doc-symbol-class"></code> or |
| 615 |
<code class="doc-symbol doc-symbol-module"></code> types. |
| 616 |
See also [`show_symbol_type_heading`][show_symbol_type_heading]. |
| 617 |
|
| 618 |
To customize symbols, see [Customizing symbol types](../customization.md#symbol-types). |
| 619 |
|
| 620 |
```yaml title="in mkdocs.yml (global configuration)" |
| 621 |
plugins: |
| 622 |
- mkdocstrings: |
| 623 |
handlers: |
| 624 |
python: |
| 625 |
options: |
| 626 |
show_symbol_type_toc: true |
| 627 |
``` |
| 628 |
|
| 629 |
```md title="or in docs/some_page.md (local configuration)" |
| 630 |
::: package.module |
| 631 |
options: |
| 632 |
show_symbol_type_toc: false |
| 633 |
``` |
| 634 |
|
| 635 |
/// admonition | Preview |
| 636 |
type: preview |
| 637 |
|
| 638 |
//// tab | With symbol type in ToC |
| 639 |
<ul style="list-style: none;"> |
| 640 |
<li><code class="doc-symbol doc-symbol-module"></code> module</li> |
| 641 |
<li><code class="doc-symbol doc-symbol-attribute"></code> attribute</li> |
| 642 |
<li><code class="doc-symbol doc-symbol-function"></code> function</li> |
| 643 |
<li><code class="doc-symbol doc-symbol-class"></code> Class |
| 644 |
<ul style="list-style: none;"> |
| 645 |
<li><code class="doc-symbol doc-symbol-method"></code> method</li> |
| 646 |
</ul> |
| 647 |
</li> |
| 648 |
</ul> |
| 649 |
//// |
| 650 |
|
| 651 |
//// tab | Without symbol type in ToC |
| 652 |
<ul style="list-style: none;"> |
| 653 |
<li>module</li> |
| 654 |
<li>attribute</li> |
| 655 |
<li>function</li> |
| 656 |
<li>Class |
| 657 |
<ul style="list-style: none;"> |
| 658 |
<li>method</li> |
| 659 |
</ul> |
| 660 |
</li> |
| 661 |
</ul> |
| 662 |
//// |
| 663 |
/// |
| 664 |
|
| 665 |
[](){#option-toc_label} |
| 666 |
## `toc_label` |
| 667 |
|
| 668 |
- **:octicons-package-24: Type [`str`][] :material-equal: `""`{ title="default value" }** |
| 669 |
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) --> |
| 670 |
|
| 671 |
A custom string to use as the label in the Table of Contents for the root object (i.e. the one specified directly after the identifier `:::`). This will override the default label generated by the plugin. See also the [`heading` option][option-heading]. |
| 672 |
|
| 673 |
WARNING: **Not advised to be used as a global configuration option.** This option is not advised to be used as a global configuration option, as it will override the default label for all objects. It is recommended to use it only in specific cases where you want to override the label for a specific object. |
| 674 |
|
| 675 |
NOTE: **Use with/without `heading`.** If you use this option without specifying a custom `heading`, the default heading will be used in the page, but the label in the Table of Contents will be the one you specified. By providing both an option for `heading` and `toc_label`, we leave the customization entirely up to you. |
| 676 |
|
| 677 |
```md title="in docs/some_page.md (local configuration)" |
| 678 |
::: path.to.module |
| 679 |
options: |
| 680 |
heading: "My fancy module" |
| 681 |
toc_label: "My fancy module" |
| 682 |
``` |
| 683 |
|
| 684 |
[](){#option-type_parameter_headings} |
| 685 |
## `type_parameter_headings` |
| 686 |
|
| 687 |
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** |
| 688 |
|
| 689 |
Whether to render headings for generic class, function/method and type alias |
| 690 |
type parameters. |
| 691 |
|
| 692 |
With this option enabled, each type parameter of a generic object (including |
| 693 |
type parameters of `__init__` methods merged in their parent class with the |
| 694 |
[`merge_init_into_class`][] option) gets a permalink, an entry in the Table of |
| 695 |
Contents, and an entry in the generated objects inventory. The permalink and |
| 696 |
inventory entry allow cross-references from internal and external pages. |
| 697 |
|
| 698 |
<!-- TODO: Update when https://github.com/mkdocstrings/griffe/issues/404 is solved. |
| 699 |
The identifier used in the permalink and inventory is of the following form: |
| 700 |
`path.to.function:type_param_name`. To manually cross-reference a parameter, |
| 701 |
you can therefore use this Markdown syntax: |
| 702 |
|
| 703 |
```md |
| 704 |
- Class type parameter: [`Param`][package.module.Class[Param\]] |
| 705 |
- Method type parameter: [`Param`][package.module.Class.method[Param\]] |
| 706 |
- Function type parameter: [`Param`][package.module.function[Param\]] |
| 707 |
- Type alias type parameter: [`Param`][package.module.TypeAlias[Param\]] |
| 708 |
- Type variable tuple: [`*Args`][package.module.function[*Args\]] |
| 709 |
- Parameter specification: [`**Params`][package.module.function[**Params\]] |
| 710 |
``` |
| 711 |
--> |
| 712 |
|
| 713 |
Enabling this option along with [`signature_crossrefs`][] will automatically |
| 714 |
render cross-references to type parameters in class/function/method/type alias |
| 715 |
signatures. |
| 716 |
|
| 717 |
```yaml title="in mkdocs.yml (global configuration)" |
| 718 |
plugins: |
| 719 |
- mkdocstrings: |
| 720 |
handlers: |
| 721 |
python: |
| 722 |
options: |
| 723 |
type_parameter_headings: false |
| 724 |
``` |
| 725 |
|
| 726 |
```md title="or in docs/some_page.md (local configuration)" |
| 727 |
::: path.to.module |
| 728 |
options: |
| 729 |
type_parameter_headings: true |
| 730 |
``` |
| 731 |
|
| 732 |
/// admonition | Preview: Cross-references |
| 733 |
type: preview |
| 734 |
|
| 735 |
```md exec="on" |
| 736 |
::: package.generics |
| 737 |
options: |
| 738 |
show_root_heading: false |
| 739 |
heading_level: 3 |
| 740 |
docstring_section_style: list |
| 741 |
show_bases: true |
| 742 |
summary: false |
| 743 |
separate_signature: true |
| 744 |
show_signature_type_parameters: true |
| 745 |
show_inheritance_diagram: false |
| 746 |
type_parameter_headings: true |
| 747 |
``` |
| 748 |
|
| 749 |
/// |
| 750 |
|
| 751 |
/// admonition | Preview: Type parameter sections |
| 752 |
type: preview |
| 753 |
|
| 754 |
//// tab | Table style |
| 755 |
```md exec="on" |
| 756 |
::: package.generics.MagicBag |
| 757 |
options: |
| 758 |
members: false |
| 759 |
heading_level: 3 |
| 760 |
show_root_heading: false |
| 761 |
show_root_toc_entry: false |
| 762 |
parameter_headings: true |
| 763 |
docstring_section_style: table |
| 764 |
show_docstring_description: false |
| 765 |
show_docstring_parameters: false |
| 766 |
show_docstring_returns: false |
| 767 |
show_inheritance_diagram: false |
| 768 |
``` |
| 769 |
//// |
| 770 |
|
| 771 |
//// tab | List style |
| 772 |
```md exec="on" |
| 773 |
::: package.generics.MagicBag |
| 774 |
options: |
| 775 |
members: false |
| 776 |
heading_level: 3 |
| 777 |
show_root_heading: false |
| 778 |
show_root_toc_entry: false |
| 779 |
parameter_headings: true |
| 780 |
docstring_section_style: list |
| 781 |
show_docstring_description: false |
| 782 |
show_docstring_parameters: false |
| 783 |
show_docstring_returns: false |
| 784 |
show_inheritance_diagram: false |
| 785 |
``` |
| 786 |
//// |
| 787 |
|
| 788 |
//// tab | Spacy style |
| 789 |
```md exec="on" |
| 790 |
::: package.generics.MagicBag |
| 791 |
options: |
| 792 |
members: false |
| 793 |
heading_level: 3 |
| 794 |
show_root_heading: false |
| 795 |
show_root_toc_entry: false |
| 796 |
parameter_headings: true |
| 797 |
docstring_section_style: spacy |
| 798 |
show_docstring_description: false |
| 799 |
show_docstring_parameters: false |
| 800 |
show_docstring_returns: false |
| 801 |
show_inheritance_diagram: false |
| 802 |
``` |
| 803 |
//// |
| 804 |
/// |
| 805 |
|
| 806 |
/// admonition | Preview: Table of contents (with symbol types) |
| 807 |
type: preview |
| 808 |
|
| 809 |
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code> mutate<br> |
| 810 |
<code class="doc-symbol doc-symbol-toc doc-symbol-type_parameter" style="margin-left: 16px;"></code> U |
| 811 |
|
| 812 |
To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types). |
| 813 |
|
| 814 |
/// |