Skip to content

Commit e1613f2

Browse files
committed
feat: Reflect show_category_heading change in material template
1 parent fd94149 commit e1613f2

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ Context:
2828
{% endif %}
2929

3030
{% if config.group_by_category %}
31-
31+
3232
{% with %}
33-
34-
{% if config.show_category_heading %}
33+
{% if config.show_category_heading is sameas true
34+
or (config.show_category_heading == "class" and obj.kind.value == "class")
35+
or (config.show_category_heading == "mod" and obj.kind.value == "module")
36+
%}
37+
{% set show_category_heading = true %}
38+
{% else %}
39+
{% set show_category_heading = false %}
40+
{% endif %}
41+
42+
{% if show_category_heading %}
3543
{% set extra_level = 1 %}
3644
{% else %}
3745
{% set extra_level = 0 %}
@@ -44,7 +52,7 @@ Context:
4452
keep_no_docstrings=config.show_if_no_docstring,
4553
) %}
4654
{% if attributes %}
47-
{% if config.show_category_heading %}
55+
{% if show_category_heading %}
4856
{% filter heading(heading_level, id=html_id ~ "-attributes", skip_inventory=config.skip_local_inventory) %}Attributes{% endfilter %}
4957
{% endif %}
5058
{% with heading_level = heading_level + extra_level %}
@@ -64,7 +72,7 @@ Context:
6472
keep_no_docstrings=config.show_if_no_docstring,
6573
) %}
6674
{% if type_aliases %}
67-
{% if config.show_category_heading %}
75+
{% if show_category_heading %}
6876
{% filter heading(heading_level, id=html_id ~ "-type_aliases") %}Type Aliases{% endfilter %}
6977
{% endif %}
7078
{% with heading_level = heading_level + extra_level %}
@@ -84,7 +92,7 @@ Context:
8492
keep_no_docstrings=config.show_if_no_docstring,
8593
) %}
8694
{% if classes %}
87-
{% if config.show_category_heading %}
95+
{% if show_category_heading %}
8896
{% filter heading(heading_level, id=html_id ~ "-classes", skip_inventory=config.skip_local_inventory) %}Classes{% endfilter %}
8997
{% endif %}
9098
{% with heading_level = heading_level + extra_level %}
@@ -104,7 +112,7 @@ Context:
104112
keep_no_docstrings=config.show_if_no_docstring,
105113
) %}
106114
{% if functions %}
107-
{% if config.show_category_heading %}
115+
{% if show_category_heading %}
108116
{% filter heading(heading_level, id=html_id ~ "-functions", skip_inventory=config.skip_local_inventory) %}Functions{% endfilter %}
109117
{% endif %}
110118
{% with heading_level = heading_level + extra_level %}
@@ -127,7 +135,7 @@ Context:
127135
keep_no_docstrings=config.show_if_no_docstring,
128136
) %}
129137
{% if modules %}
130-
{% if config.show_category_heading %}
138+
{% if show_category_heading %}
131139
{% filter heading(heading_level, id=html_id ~ "-modules", skip_inventory=config.skip_local_inventory) %}Modules{% endfilter %}
132140
{% endif %}
133141
{% with heading_level = heading_level + extra_level %}

0 commit comments

Comments
 (0)