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 43ff423..21d4005 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja @@ -33,10 +33,13 @@ Context: {% set attribute_name = attribute.path if show_full_path else attribute.name %} + {% set object_type = "data" if attribute.parent.is_module else "property" if "property" in attribute.labels else "attribute" %} + {#- Object type in objects inventory. -#} + {% if not root or config.show_root_heading %} {% filter heading( heading_level, - role=("data" if attribute.parent.kind.value == "module" else "attr"), + role=object_type, id=html_id, class="doc doc-heading", toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute.name), @@ -89,7 +92,7 @@ Context: {% if config.show_root_toc_entry %} {% filter heading(heading_level, - role=("data" if attribute.parent.kind.value == "module" else "attr"), + role=object_type, id=html_id, toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute_name), hidden=True, 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 17e9e29..1eba81c 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja @@ -158,7 +158,7 @@ Context: {% block inheritance_diagram scoped %} {#- Inheritance diagram block. - + This block renders the inheritance diagram for the class, using Mermaid syntax and a bit of JavaScript to make the nodes clickable, linking to the corresponding class documentation. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja index a67113f..704fd1c 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja @@ -38,7 +38,7 @@ Context: {% if config.parameter_headings %} {% filter heading( heading_level + 1, - role="param", + role="parameter", id=html_id ~ "(" ~ parameter.name ~ ")", class="doc doc-heading doc-heading-parameter", toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name, @@ -86,7 +86,7 @@ Context: {% if config.parameter_headings %} {% filter heading( heading_level + 1, - role="param", + role="parameter", id=html_id ~ "(" ~ parameter.name ~ ")", class="doc doc-heading doc-heading-parameter", toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name, @@ -132,7 +132,7 @@ Context: {% if config.parameter_headings %} {% filter heading( heading_level + 1, - role="param", + role="parameter", id=html_id ~ "(" ~ parameter.name ~ ")", class="doc doc-heading doc-heading-parameter", toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name, diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja index 6fe8bb4..71e620d 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja @@ -42,7 +42,7 @@ Context: {% if config.type_parameter_headings %} {% filter heading( heading_level + 1, - role="typeparam", + role="typeparameter", id=obj.path ~ "[" ~ type_parameter.name ~ "]", class="doc doc-heading doc-heading-type_parameter", toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name, @@ -93,7 +93,7 @@ Context: {% if config.type_parameter_headings %} {% filter heading( heading_level + 1, - role="typeparam", + role="typeparameter", id=obj.path ~ "[" ~ type_parameter.name ~ "]", class="doc doc-heading doc-heading-type_parameter", toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name, @@ -156,7 +156,7 @@ Context: {% if config.type_parameter_headings %} {% filter heading( heading_level + 1, - role="typeparam", + role="typeparameter", id=obj.path ~ "[" ~ type_parameter.name ~ "]", class="doc doc-heading doc-heading-type_parameter", toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name, 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 c824226..7805828 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja @@ -37,11 +37,13 @@ Context: {#- Brief or full function name depending on configuration. -#} {% set symbol_type = "method" if function.parent.is_class else "function" %} {#- Symbol type: method when parent is a class, function otherwise. -#} + {% set object_type = symbol_type %} + {#- Object type in objects inventory. -#} {% if not root or config.show_root_heading %} {% filter heading( heading_level, - role="function", + role=object_type, id=html_id, class="doc doc-heading", toc_label=((' ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name), @@ -106,7 +108,7 @@ Context: {% if config.show_root_toc_entry %} {% filter heading( heading_level, - role="function", + role=object_type, id=html_id, toc_label=((' ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name), hidden=True, diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja index ff1e846..43c4c4a 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja @@ -35,7 +35,7 @@ Context: {% if not root or config.show_root_heading %} {% filter heading( heading_level, - role="typealias", + role="type", id=html_id, class="doc doc-heading", toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_alias.name, @@ -83,7 +83,7 @@ Context: {% else %} {% if config.show_root_toc_entry %} {% filter heading(heading_level, - role="typealias", + role="type", id=html_id, toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_alias.name, hidden=True,