diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
index dd258191..519590e5 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
@@ -48,8 +48,10 @@ Context:
This block renders the heading for the attribute.
-#}
{% if config.show_symbol_type_heading %}{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else attribute_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ attribute_name }}
{% else %}
{%+ filter highlight(language="python", inline=True) %}
{{ attribute_name }}{% if attribute.annotation and config.show_signature_annotations %}: {{ attribute.annotation }}{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
index ae2f8de5..8a54dd1b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
@@ -47,8 +47,10 @@ Context:
This block renders the heading for the class.
-#}
{% if config.show_symbol_type_heading %}
{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else class_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ class_name }}
{% elif config.merge_init_into_class and "__init__" in all_members %}
{% with function = all_members["__init__"] %}
{%+ filter highlight(language="python", inline=True) -%}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
index e56bc7e4..21888939 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
@@ -54,8 +54,10 @@ Context:
This block renders the heading for the function.
-#}
{% if config.show_symbol_type_heading %}
{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else function_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ function_name }}
{% else %}
{%+ filter highlight(language="python", inline=True) -%}
{#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
index d2b5516d..283f2654 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
@@ -47,8 +47,10 @@ Context:
This block renders the heading for the module.
-#}
{% if config.show_symbol_type_heading %}
{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else module_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ module_name }}
{% else %}
{{ module_name }}
{% endif %}
diff --git a/tests/snapshots/__init__.py b/tests/snapshots/__init__.py
index e411bfa8..556133ac 100644
--- a/tests/snapshots/__init__.py
+++ b/tests/snapshots/__init__.py
@@ -383,5 +383,23 @@
(("filters", "public"), ("inherited_members", False), ("members", ("module_attribute",))): external(
"80399c502938*.html",
),
+ (("heading", ""), ("members", False), ("separate_signature", False), ("show_if_no_docstring", True)): external(
+ "d1dd339f9260*.html",
+ ),
+ (
+ ("heading", "Some heading"),
+ ("members", False),
+ ("separate_signature", True),
+ ("show_if_no_docstring", True),
+ ): external("480324b25439*.html"),
+ (("heading", ""), ("members", False), ("separate_signature", True), ("show_if_no_docstring", True)): external(
+ "2eef87791b97*.html",
+ ),
+ (
+ ("heading", "Some heading"),
+ ("members", False),
+ ("separate_signature", False),
+ ("show_if_no_docstring", True),
+ ): external("51deee0f00f3*.html"),
},
)
diff --git a/tests/snapshots/external/2eef87791b974c724d2cd98e40bb25994087bc836868f63da18557a6094a00ee.html b/tests/snapshots/external/2eef87791b974c724d2cd98e40bb25994087bc836868f63da18557a6094a00ee.html
new file mode 100644
index 00000000..f0242792
--- /dev/null
+++ b/tests/snapshots/external/2eef87791b974c724d2cd98e40bb25994087bc836868f63da18557a6094a00ee.html
@@ -0,0 +1,20 @@
+
+
+
+ headings_package
+
+