+ some_attr:
+ int
+
+instance-attribute
+////
+
+//// tab | Without labels
+
+ some_attr:
+ int
+
+////
+///
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 7ffdaf6b..c5217e98 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -106,6 +106,7 @@ class PythonHandler(BaseHandler):
"preload_modules": None,
"allow_inspection": True,
"summary": False,
+ "show_labels": True,
"unwrap_annotated": False,
}
"""Default handler configuration.
@@ -154,6 +155,7 @@ class PythonHandler(BaseHandler):
group_by_category (bool): Group the object's children by categories: attributes, classes, functions, and modules. Default: `True`.
show_submodules (bool): When rendering a module, show its submodules recursively. Default: `False`.
summary (bool | dict[str, bool]): Whether to render summaries of modules, classes, functions (methods) and attributes.
+ show_labels (bool): Whether to show labels of the members. Default: `True`.
Attributes: Docstrings options:
docstring_style (str): The docstring style to use: `google`, `numpy`, `sphinx`, or `None`. Default: `"google"`.
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
index 0c84067a..a35bffbb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
@@ -1,4 +1,4 @@
-{% if labels %}
+{% if config.show_labels and labels %}
{{ log.debug("Rendering labels") }}
{% for label in labels|sort %}
From 6364fbcd4012d2026aa9efe4501b697f08b8c6ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= `
+ sponsors.forEach(function (sponsor) {
+ html += `
+
+
+
+ `
+ });
+ html += '
'
- sponsors.forEach(function (sponsor) {
- html += `
-
-
-
- `
- });
- html += '
'
-src = Path(__file__).parent.parent / "src"
+root = Path(__file__).parent.parent
+src = root / "src"
for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
@@ -30,7 +31,7 @@
ident = ".".join(parts)
fd.write(f"::: {ident}")
- mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path)
+ mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
From 0dd0b7956bc2db2e492404cb5a445ad49f126a9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= A Python handler for mkdocstrings.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ section.title or lang.t("Attributes:") }}
+{{ section.title or lang.t("Attributes:") }}
{{ attribute.name }} |
{% if attribute.annotation %}
@@ -36,10 +36,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Attributes:") }} +{{ section.title or lang.t("Attributes:") }}
|