Skip to content

feat: Add skip_local_inventory option to not register objects in the local inventory #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Move skip_local_inventory to general options
  • Loading branch information
bswck committed Jul 14, 2025
commit 3c4e610ee04e2c81fc0d46a84e6508f9e18522c6
60 changes: 60 additions & 0 deletions docs/usage/configuration/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,63 @@ def some_function():
<p>Docstring of the function.</p>
////
///

[](){#option-skip_local_inventory}
## `skip_local_inventory`

- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) -->

Whether to not give objects local inventory entries.

With this option enabled, re-rendering docstrings for objects from external inventories is possible with their cross-references pointing to the original external inventory, not local.

```yaml title="in mkdocs.yml (global configuration)"
plugins:
- mkdocstrings:
handlers:
python:
options:
skip_local_inventory: false
```

```md title="or in docs/some_page.md (local configuration)"
::: path.to.module
options:
skip_local_inventory: true
```

/// admonition | Preview
type: preview


//// tab | Without `skip_local_inventory`

```md exec="on"
::: bisect.bisect_left
options:
heading_level: 3
skip_local_inventory: false
show_docstring_description: false
```

Notice how [`bisect.bisect_left`][] now points to the section above.

////

//// tab | With `skip_local_inventory`

```md exec="on"
::: bisect.bisect_right
inventories:
- https://docs.python.org/3/objects.inv
options:
heading_level: 3
skip_local_inventory: true
show_docstring_description: false
```

Notice how [`bisect.bisect_right`][] points to the original Python documentation.

////
///
62 changes: 0 additions & 62 deletions docs/usage/configuration/headings.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,68 +664,6 @@ plugins:
////
///


[](){#option-skip_local_inventory}
## `skip_local_inventory`

- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
<!-- - **:octicons-project-template-24: Template :material-null:** (N/A) -->

Whether to not give objects local inventory entries.

With this option enabled, re-rendering docstrings for objects from external inventories is possible with their cross-references pointing to the original external inventory, not local.

```yaml title="in mkdocs.yml (global configuration)"
plugins:
- mkdocstrings:
handlers:
python:
options:
skip_local_inventory: false
```

```md title="or in docs/some_page.md (local configuration)"
::: path.to.module
options:
skip_local_inventory: true
```

/// admonition | Preview
type: preview


//// tab | Without `skip_local_inventory`

```md exec="on"
::: bisect.bisect_left
options:
heading_level: 3
skip_local_inventory: false
show_docstring_description: false
```

Notice how [`bisect.bisect_left`][] now points to the section above.

////

//// tab | With `skip_local_inventory`

```md exec="on"
::: bisect.bisect_right
inventories:
- https://docs.python.org/3/objects.inv
options:
heading_level: 3
skip_local_inventory: true
show_docstring_description: false
```

Notice how [`bisect.bisect_right`][] points to the original Python documentation.

////

///

[](){#option-toc_label}
## `toc_label`

Expand Down
2 changes: 1 addition & 1 deletion src/mkdocstrings_handlers/python/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ class PythonInputOptions:
skip_local_inventory: Annotated[
bool,
_Field(
group="headings",
group="general",
description="Whether to not give objects local inventory entries.",
),
] = False
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy