diff --git a/docs/usage/configuration/headings.md b/docs/usage/configuration/headings.md index 63950206..467779e4 100644 --- a/docs/usage/configuration/headings.md +++ b/docs/usage/configuration/headings.md @@ -59,7 +59,6 @@ plugins: ## `parameter_headings` -[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } — [:octicons-tag-24: Insiders 1.6.0](../../insiders/changelog.md#1.6.0) - **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md index 119d8294..220a26fe 100644 --- a/docs/usage/configuration/members.md +++ b/docs/usage/configuration/members.md @@ -552,7 +552,6 @@ package ## `summary` -[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } — [:octicons-tag-24: Insiders 1.2.0](../../insiders/changelog.md#1.2.0) - **:octicons-package-24: Type bool | dict[str, bool] :material-equal: `False`{ title="default value" }** diff --git a/pyproject.toml b/pyproject.toml index 2d5640c4..636a67fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ classifiers = [ "Programming Language :: Python :: 3.14", "Topic :: Documentation", "Topic :: Software Development", + "Topic :: Software Development :: Documentation", "Topic :: Utilities", "Typing :: Typed", ] diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py index aa690bca..0aac3cdc 100644 --- a/src/mkdocstrings_handlers/python/handler.py +++ b/src/mkdocstrings_handlers/python/handler.py @@ -104,6 +104,7 @@ class PythonHandler(BaseHandler): "show_docstring_yields": True, "show_source": True, "show_bases": True, + "show_inheritance_diagram": False, "show_submodules": False, "group_by_category": True, "heading_level": 2, @@ -119,6 +120,7 @@ class PythonHandler(BaseHandler): "show_labels": True, "unwrap_annotated": False, "parameter_headings": False, + "modernize_annotations": False, } """Default handler configuration. @@ -126,6 +128,7 @@ class PythonHandler(BaseHandler): find_stubs_package (bool): Whether to load stubs package (package-stubs) when extracting docstrings. Default `False`. allow_inspection (bool): Whether to allow inspecting modules when visiting them is not possible. Default: `True`. show_bases (bool): Show the base classes of a class. Default: `True`. + show_inheritance_diagram (bool): Show the inheritance diagram of a class using Mermaid. Default: `False`. show_source (bool): Show the source code of this object. Default: `True`. preload_modules (list[str] | None): Pre-load modules that are not specified directly in autodoc instructions (`::: identifier`). @@ -200,6 +203,7 @@ class PythonHandler(BaseHandler): separate_signature (bool): Whether to put the whole signature in a code block below the heading. If Black is installed, the signature is also formatted using it. Default: `False`. unwrap_annotated (bool): Whether to unwrap `Annotated` types to show only the type without the annotations. Default: `False`. + modernize_annotations (bool): Whether to modernize annotations, for example `Optional[str]` into `str | None`. Default: `False`. """ def __init__( @@ -274,7 +278,7 @@ def load_inventory( ) -> Iterator[tuple[str, str]]: """Yield items and their URLs from an inventory file streamed from `in_file`. - This implements mkdocstrings' `load_inventory` "protocol" (see [`mkdocstrings.plugin`][mkdocstrings.plugin]). + This implements mkdocstrings' `load_inventory` "protocol" (see [`mkdocstrings.plugin`][]). Arguments: in_file: The binary file-like object to read the inventory from. diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py index e3e9530f..a7ea38f7 100644 --- a/src/mkdocstrings_handlers/python/rendering.py +++ b/src/mkdocstrings_handlers/python/rendering.py @@ -612,7 +612,9 @@ def __init__(self, current_object: Object | Alias, config: dict[str, Any]) -> No config: The configuration dictionary. """ self.current_object = current_object + """The current object being rendered.""" self.config = config + """The configuration options.""" def expand_identifier(self, identifier: str) -> str: """Expand an identifier. diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja index 5b643726..1465471d 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja @@ -9,10 +9,10 @@ {% set lang_pth = "languages/" ~ locale | get_template %} {% if lang_pth is existing_template %} - {% import lang_pth as lang %} - {% import "languages/en"|get_template as fallback %} - {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %} + {% import lang_pth as lang %} + {% import "languages/en"|get_template as fallback %} + {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %} {% else %} - {% import "languages/en"|get_template as lang %} - {% macro t(key) %}{{ lang.t(key) }}{% endmacro %} + {% import "languages/en"|get_template as lang %} + {% macro t(key) %}{{ lang.t(key) }}{% endmacro %} {% endif %}