Skip to content

Commit 63df2c8

Browse files
committed
Implement skip_local_inventory option
1 parent d57c79c commit 63df2c8

File tree

7 files changed

+23
-4
lines changed

7 files changed

+23
-4
lines changed

src/mkdocstrings_handlers/python/_internal/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,14 @@ class PythonInputOptions:
865865
),
866866
] = False
867867

868+
skip_local_inventory: Annotated[
869+
bool,
870+
_Field(
871+
group="headings",
872+
description="Whether to not give objects local inventory entries and permalinks.",
873+
),
874+
] = False
875+
868876
signature_crossrefs: Annotated[
869877
bool,
870878
_Field(

src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Context:
4040
id=html_id,
4141
class="doc doc-heading",
4242
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute.name),
43+
skip_inventory=config.skip_local_inventory,
4344
) %}
4445

4546
{% block heading scoped %}
@@ -93,6 +94,7 @@ Context:
9394
id=html_id,
9495
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute_name),
9596
hidden=True,
97+
skip_inventory=config.skip_local_inventory,
9698
) %}
9799
{% endfilter %}
98100
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Context:
4545
) %}
4646
{% if attributes %}
4747
{% if config.show_category_heading %}
48-
{% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
48+
{% filter heading(heading_level, id=html_id ~ "-attributes", skip_inventory=config.skip_local_inventory) %}Attributes{% endfilter %}
4949
{% endif %}
5050
{% with heading_level = heading_level + extra_level %}
5151
{% for attribute in attributes|order_members(config.members_order, members_list) %}
@@ -65,7 +65,7 @@ Context:
6565
) %}
6666
{% if classes %}
6767
{% if config.show_category_heading %}
68-
{% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
68+
{% filter heading(heading_level, id=html_id ~ "-classes", skip_inventory=config.skip_local_inventory) %}Classes{% endfilter %}
6969
{% endif %}
7070
{% with heading_level = heading_level + extra_level %}
7171
{% for class in classes|order_members(config.members_order, members_list) %}
@@ -85,7 +85,7 @@ Context:
8585
) %}
8686
{% if functions %}
8787
{% if config.show_category_heading %}
88-
{% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
88+
{% filter heading(heading_level, id=html_id ~ "-functions", skip_inventory=config.skip_local_inventory) %}Functions{% endfilter %}
8989
{% endif %}
9090
{% with heading_level = heading_level + extra_level %}
9191
{% for function in functions|order_members(config.members_order, members_list) %}
@@ -108,7 +108,7 @@ Context:
108108
) %}
109109
{% if modules %}
110110
{% if config.show_category_heading %}
111-
{% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
111+
{% filter heading(heading_level, id=html_id ~ "-modules", skip_inventory=config.skip_local_inventory) %}Modules{% endfilter %}
112112
{% endif %}
113113
{% with heading_level = heading_level + extra_level %}
114114
{% for module in modules|order_members("alphabetical", members_list) %}

src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Context:
3939
id=html_id,
4040
class="doc doc-heading",
4141
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-class"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
42+
skip_inventory=config.skip_local_inventory,
4243
) %}
4344

4445
{% block heading scoped %}
@@ -112,6 +113,7 @@ Context:
112113
id=html_id,
113114
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-class"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
114115
hidden=True,
116+
skip_inventory=config.skip_local_inventory,
115117
) %}
116118
{% endfilter %}
117119
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Context:
4343
id=html_id ~ "(" ~ parameter.name ~ ")",
4444
class="doc doc-heading doc-heading-parameter",
4545
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-parameter"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + parameter.name,
46+
skip_inventory=config.skip_local_inventory,
4647
) %}
4748
<code>{{ parameter.name }}</code>
4849
{% endfilter %}
@@ -92,6 +93,7 @@ Context:
9293
id=html_id ~ "(" ~ parameter.name ~ ")",
9394
class="doc doc-heading doc-heading-parameter",
9495
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-parameter"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + parameter.name,
96+
skip_inventory=config.skip_local_inventory,
9597
) %}
9698
<b><code>{{ parameter.name }}</code></b>
9799
{% endfilter %}
@@ -139,6 +141,7 @@ Context:
139141
id=html_id ~ "(" ~ parameter.name ~ ")",
140142
class="doc doc-heading doc-heading-parameter",
141143
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-parameter"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + parameter.name,
144+
skip_inventory=config.skip_local_inventory,
142145
) %}
143146
<code>{{ parameter.name }}</code>
144147
{% endfilter %}

src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Context:
4646
id=html_id,
4747
class="doc doc-heading",
4848
toc_label=(('<code class="doc-symbol doc-symbol-toc doc-symbol-' + symbol_type + '"></code>&nbsp;')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
49+
skip_inventory=config.skip_local_inventory,
4950
) %}
5051

5152
{% block heading scoped %}
@@ -110,6 +111,7 @@ Context:
110111
id=html_id,
111112
toc_label=(('<code class="doc-symbol doc-symbol-toc doc-symbol-' + symbol_type + '"></code>&nbsp;')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
112113
hidden=True,
114+
skip_inventory=config.skip_local_inventory,
113115
) %}
114116
{% endfilter %}
115117
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Context:
3939
id=html_id,
4040
class="doc doc-heading",
4141
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
42+
skip_inventory=config.skip_local_inventory,
4243
) %}
4344

4445
{% block heading scoped %}
@@ -76,6 +77,7 @@ Context:
7677
id=html_id,
7778
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
7879
hidden=True,
80+
skip_inventory=config.skip_local_inventory,
7981
) %}
8082
{% endfilter %}
8183
{% endif %}

0 commit comments

Comments
 (0)