From 0c1e2c15b2497d99974cbb9bd68f25056bb8451b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Tue, 2 Apr 2024 21:27:22 +0200 Subject: [PATCH 001/171] deps: Remove cap on Python-Markdown 3.6 now that ToC labels are fixed by mkdocstrings --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 05438338..1ce73547 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,7 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "markdown>=3.3,<3.6", - "mkdocstrings>=0.20", + "mkdocstrings>=0.24.2", "griffe>=0.37", ] From 0a2e917cca07ad54ea7da782ab7914f9c9accc5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Tue, 2 Apr 2024 21:27:58 +0200 Subject: [PATCH 002/171] chore: Prepare release 1.9.2 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a06cd76..b0e9c966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.9.2](https://github.com/mkdocstrings/python/releases/tag/1.9.2) - 2024-04-02 + +[Compare with 1.9.1](https://github.com/mkdocstrings/python/compare/1.9.1...1.9.2) + +### Dependencies + +- Remove cap on Python-Markdown 3.6 now that ToC labels are fixed by mkdocstrings ([0c1e2c1](https://github.com/mkdocstrings/python/commit/0c1e2c15b2497d99974cbb9bd68f25056bb8451b) by Timothée Mazzucotelli). + ## [1.9.1](https://github.com/mkdocstrings/python/releases/tag/1.9.1) - 2024-04-02 [Compare with 1.9.0](https://github.com/mkdocstrings/python/compare/1.9.0...1.9.1) From d6e1d68c099e61c3bd6d93e583708335d84158f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 12 Apr 2024 16:59:55 +0200 Subject: [PATCH 003/171] feat: Add CSS classes `doc-section-title` and `doc-section-item` in docstring sections Issue-17: https://github.com/mkdocstrings/python/issues/17 --- .../material/_base/docstring/attributes.html | 14 +++++++------- .../material/_base/docstring/classes.html | 14 +++++++------- .../material/_base/docstring/examples.html | 2 +- .../material/_base/docstring/functions.html | 14 +++++++------- .../material/_base/docstring/modules.html | 14 +++++++------- .../material/_base/docstring/other_parameters.html | 14 +++++++------- .../material/_base/docstring/parameters.html | 14 +++++++------- .../templates/material/_base/docstring/raises.html | 14 +++++++------- .../material/_base/docstring/receives.html | 14 +++++++------- .../material/_base/docstring/returns.html | 14 +++++++------- .../templates/material/_base/docstring/warns.html | 14 +++++++------- .../templates/material/_base/docstring/yields.html | 14 +++++++------- .../python/templates/material/style.css | 5 +++++ 13 files changed, 83 insertions(+), 78 deletions(-) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html index 88c5990d..771a9eed 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

{{ section.title or lang.t("Attributes:") }}

+

{{ section.title or lang.t("Attributes:") }}

@@ -15,7 +15,7 @@ {% for attribute in section.value %} - +
{{ 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:") }}

    {% for attribute in section.value %} -
  • +
  • {{ attribute.name }} {% if attribute.annotation %} {% with expression = attribute.annotation %} @@ -59,13 +59,13 @@ - - + + {% for attribute in section.value %} - +
    {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
    {{ attribute.name }}
    diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html index b8ad2e0f..054cf5af 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

    {{ section.title or lang.t("Classes:") }}

    +

    {{ section.title or lang.t("Classes:") }}

    @@ -14,7 +14,7 @@ {% for class in section.value %} - +
    {{ class.name }}
    @@ -28,10 +28,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

    {{ section.title or lang.t("Classes:") }}

    +

    {{ section.title or lang.t("Classes:") }}

      {% for class in section.value %} -
    • +
    • {{ class.name }}
      @@ -46,13 +46,13 @@ - - + + {% for class in section.value %} - +
      {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("CLASS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
      {{ class.name }}
      diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html index bbec5e22..5305efa9 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html @@ -2,7 +2,7 @@ {% import "language.html" as lang with context %} -

      {{ section.title or lang.t("Examples:") }}

      +

      {{ section.title or lang.t("Examples:") }}

      {% for section_type, sub_section in section.value %} {% if section_type.value == "text" %} {{ sub_section|convert_markdown(heading_level, html_id) }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html index ab1939f5..a16917bd 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

      {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

      +

      {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

      @@ -15,7 +15,7 @@ {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %} - + - - + +
      {{ function.name }}
      @@ -30,11 +30,11 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

      {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

      +

      {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

        {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %} -
      • +
      • {{ function.name }}
        @@ -50,14 +50,14 @@ - - + + {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %} - + + {% for yields in section.value %} + + {% if name_column %}{% endif %} + + + + {% endfor %} + +
        {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
        {{ function.name }}
        diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html index f771f20b..26b38257 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

        {{ section.title or lang.t("Modules:") }}

        +

        {{ section.title or lang.t("Modules:") }}

        @@ -14,7 +14,7 @@ {% for module in section.value %} - + + {% for warns in section.value %} + + + + + {% endfor %} + +
        {{ module.name }}
        @@ -28,10 +28,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

        {{ section.title or lang.t("Modules:") }}

        +

        {{ section.title or lang.t("Modules:") }}

          {% for module in section.value %} -
        • +
        • {{ module.name }}
          @@ -46,13 +46,13 @@ - - + + {% for module in section.value %} - + + {% for warns in section.value %} + + + + + {% endfor %} + +
          {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("MODULE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
          {{ module.name }}
          diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html index 7ede6715..f31836a8 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

          {{ section.title or lang.t("Other Parameters:") }}

          +

          {{ section.title or lang.t("Other Parameters:") }}

          @@ -15,7 +15,7 @@ {% for parameter in section.value %} - + + {% for returns in section.value %} + + {% if name_column %}{% endif %} + + + + {% endfor %} + +
          {{ parameter.name }} {% if parameter.annotation %} @@ -36,10 +36,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

          {{ section.title or lang.t("Other Parameters:") }}

          +

          {{ section.title or lang.t("Other Parameters:") }}

            {% for parameter in section.value %} -
          • +
          • {{ parameter.name }} {% if parameter.annotation %} {% with expression = parameter.annotation %} @@ -59,13 +59,13 @@ - - + + {% for parameter in section.value %} - + + {% for receives in section.value %} + + {% if name_column %}{% endif %} + + + + {% endfor %} + +
            {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
            {{ parameter.name }}
            diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html index 7b4788ca..05bdadee 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

            {{ section.title or lang.t("Parameters:") }}

            +

            {{ section.title or lang.t("Parameters:") }}

            @@ -16,7 +16,7 @@ {% for parameter in section.value %} - + + {% for raises in section.value %} + + + + + {% endfor %} + +
            {{ parameter.name }} {% if parameter.annotation %} @@ -46,10 +46,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

            {{ section.title or lang.t("Parameters:") }}

            +

            {{ section.title or lang.t("Parameters:") }}

              {% for parameter in section.value %} -
            • +
            • {{ parameter.name }} {% if parameter.annotation %} {% with expression = parameter.annotation %} @@ -74,13 +74,13 @@ - - + + {% for parameter in section.value %} - + + {% for raises in section.value %} + + + + + {% endfor %} + +
              {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} {{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
              {{ parameter.name }}
              diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html index 396ccc73..5e20b653 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

              {{ section.title or lang.t("Raises:") }}

              +

              {{ section.title or lang.t("Raises:") }}

              @@ -14,7 +14,7 @@ {% for raises in section.value %} - + + {% for parameter in section.value %} + + + + + {% endfor %} + +
              {% if raises.annotation %} {% with expression = raises.annotation %} @@ -34,10 +34,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

              {{ lang.t(section.title) or lang.t("Raises:") }}

              +

              {{ lang.t(section.title) or lang.t("Raises:") }}

                {% for raises in section.value %} -
              • +
              • {% if raises.annotation %} {% with expression = raises.annotation %} {% include "expression.html" with context %} @@ -56,13 +56,13 @@ - - + + {% for raises in section.value %} - + + {% for parameter in section.value %} + + + + + + + {% endfor %} + +
                {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("RAISES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                {% with expression = raises.annotation %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html index 77d83c0b..e03e8b8e 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html @@ -5,7 +5,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} {% set name_column = section.value|selectattr("name")|any %} -

                {{ section.title or lang.t("Receives:") }}

                +

                {{ section.title or lang.t("Receives:") }}

                @@ -16,7 +16,7 @@ {% for receives in section.value %} - + {% if name_column %}{% endif %} + {% for parameter in section.value %} + + + + + {% endfor %} + +
                {% if receives.name %}{{ receives.name }}{% endif %} {% if receives.annotation %} @@ -37,10 +37,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                {{ section.title or lang.t("Receives:") }}

                +

                {{ section.title or lang.t("Receives:") }}

                  {% for receives in section.value %} -
                • +
                • {% if receives.name %}{{ receives.name }}{% endif %} {% if receives.annotation %} {% with expression = receives.annotation %} @@ -62,13 +62,13 @@ - - + + {% for receives in section.value %} - + + {% for parameter in section.value %} + + + + + + {% endfor %} + +
                  {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                  {% if receives.name %} {{ receives.name }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html index b19917a3..a7a7cb98 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html @@ -5,7 +5,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} {% set name_column = section.value|selectattr("name")|any %} -

                  {{ section.title or lang.t("Returns:") }}

                  +

                  {{ section.title or lang.t("Returns:") }}

                  @@ -16,7 +16,7 @@ {% for returns in section.value %} - + {% if name_column %}{% endif %} + {% for module in section.value %} + + + + + {% endfor %} + +
                  {% if returns.name %}{{ returns.name }}{% endif %} {% if returns.annotation %} @@ -37,10 +37,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                  {{ section.title or lang.t("Returns:") }}

                  +

                  {{ section.title or lang.t("Returns:") }}

                    {% for returns in section.value %} -
                  • +
                  • {% if returns.name %}{{ returns.name }}{% endif %} {% if returns.annotation %} {% with expression = returns.annotation %} @@ -62,13 +62,13 @@ - - + + {% for returns in section.value %} - + + {% for module in section.value %} + + + + + {% endfor %} + +
                    {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION").upper() }}{{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION").upper() }}
                    {% if returns.name %} {{ returns.name }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html index 8377669f..a9bdae26 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html @@ -4,7 +4,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                    {{ section.title or lang.t("Warns:") }}

                    +

                    {{ section.title or lang.t("Warns:") }}

                    @@ -14,7 +14,7 @@ {% for warns in section.value %} - + + {% for class in section.value %} + + + + + {% endfor %} + +
                    {% if warns.annotation %} {% with expression = warns.annotation %} @@ -34,10 +34,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                    {{ section.title or lang.t("Warns:") }}

                    +

                    {{ section.title or lang.t("Warns:") }}

                      {% for warns in section.value %} -
                    • +
                    • {% if warns.annotation %} {% with expression = warns.annotation %} {% include "expression.html" with context %} @@ -56,13 +56,13 @@ - - + + {% for warns in section.value %} - + + {% for class in section.value %} + + + + + {% endfor %} + +
                      {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("WARNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                      {% with expression = warns.annotation %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html index c69135ea..6c4cb0b0 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html @@ -5,7 +5,7 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} {% set name_column = section.value|selectattr("name")|any %} -

                      {{ section.title or lang.t("Yields:") }}

                      +

                      {{ section.title or lang.t("Yields:") }}

                      @@ -16,7 +16,7 @@ {% for yields in section.value %} - + {% if name_column %}{% endif %} + {% for attribute in section.value %} + + + + + {% endfor %} + +
                      {% if yields.name %}{{ yields.name }}{% endif %} {% if yields.annotation %} @@ -37,10 +37,10 @@ {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                      {{ section.title or lang.t("Yields:") }}

                      +

                      {{ section.title or lang.t("Yields:") }}

                        {% for yields in section.value %} -
                      • +
                      • {% if yields.name %}{{ yields.name }}{% endif %} {% if yields.annotation %} {% with expression = yields.annotation %} @@ -62,13 +62,13 @@ - - + + {% for yields in section.value %} - + + {% for attribute in section.value %} + + + + + + {% endfor %} + +
                        {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}{{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                        {% if yields.name %} {{ yields.name }} diff --git a/src/mkdocstrings_handlers/python/templates/material/style.css b/src/mkdocstrings_handlers/python/templates/material/style.css index 805c64c3..154be85d 100644 --- a/src/mkdocstrings_handlers/python/templates/material/style.css +++ b/src/mkdocstrings_handlers/python/templates/material/style.css @@ -25,6 +25,11 @@ float: right; } +/* Backward-compatibility: docstring section titles in bold. */ +.doc-section-title { + font-weight: bold; +} + /* Symbols in Navigation and ToC. */ :root, [data-md-color-scheme="default"] { From 9f8456a55b9659d86a42f684d85b69b218226b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 12 Apr 2024 17:47:24 +0200 Subject: [PATCH 004/171] docs: Improve docs about CSS customization Issue-48: https://github.com/mkdocstrings/python/issues/48 --- docs/usage/customization.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/usage/customization.md b/docs/usage/customization.md index 2567870e..8eedadd1 100644 --- a/docs/usage/customization.md +++ b/docs/usage/customization.md @@ -5,6 +5,26 @@ and/or by overriding templates. ## CSS classes +Our templates add [CSS](https://www.w3schools.com/Css/) classes to many HTML elements +to make it possible for users to customize the resulting look and feel. + +To add CSS rules and style mkdocstrings' output, +put them in a CSS file in your docs folder, for example in `docs/css/mkdocstrings.css`, +and reference this file in [MkDocs' `extra_css` configuration option](https://www.mkdocs.org/user-guide/configuration/#extra_css): + +```yaml title="mkdocs.yml" +extra_css: +- css/mkdocstrings.css +``` + +Example: + +```css title="docs/css/mkdocstrings.css" +.doc-section-title { + font-weight: bold; +} +``` + The following CSS classes are used in the generated HTML: - `doc`: on all the following elements @@ -22,6 +42,8 @@ The following CSS classes are used in the generated HTML: - `doc-labels`: on `span`s wrapping the object's labels - `doc-label`: on `small` elements containing a label - `doc-label-LABEL`: same, where `LABEL` is replaced by the actual label +- `doc-section-title`: on section titles (depend on the [selected style for section rendering][docstring_style]) +- `doc-section-item`: on section items (depend on the [selected style for section rendering][docstring_style]) - `doc-md-description`: on `div`s containing HTML descriptions converted from Markdown docstrings - `doc-symbol`: on `code` tags of symbol types - `doc-symbol-heading`: on symbol types in headings From 11d81d8e056b7c074eb3a1c47606867156a338fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 19 Apr 2024 15:06:16 +0200 Subject: [PATCH 005/171] fix: Render enumeration instance name instead of just "value", allowing proper cross-reference Issue-124: https://github.com/mkdocstrings/python/issues/124 --- pyproject.toml | 2 +- .../python/templates/material/_base/expression.html | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1ce73547..c02461f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dependencies = [ "mkdocstrings>=0.24.2", - "griffe>=0.37", + "griffe>=0.44", ] [project.urls] diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html index cbc84e43..00e1c761 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html @@ -29,7 +29,11 @@ {{ render(expression.slice.elements[0], annotations_path) }} {%- elif expression.classname == "ExprAttribute" -%} {%- if annotations_path == "brief" -%} - {{ render(expression.last, "brief") }} + {%- if expression.last.is_enum_value -%} + {{ crossref(expression.last.parent, "brief") }}.value + {%- else -%} + {{ render(expression.last, "brief") }} + {%- endif -%} {%- elif annotations_path == "full" -%} {{ render(expression.first, "full") }} {%- for element in expression -%} From 98e9796fe8ab6eee1ea0a16f1179a0e4f37bcf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 19 Apr 2024 15:10:31 +0200 Subject: [PATCH 006/171] chore: Prepare release 1.10.0 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0e9c966..1fdbdf36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.10.0](https://github.com/mkdocstrings/python/releases/tag/1.10.0) - 2024-04-19 + +[Compare with 1.9.2](https://github.com/mkdocstrings/python/compare/1.9.2...1.10.0) + +### Features + +- Add CSS classes `doc-section-title` and `doc-section-item` in docstring sections ([d6e1d68](https://github.com/mkdocstrings/python/commit/d6e1d68c099e61c3bd6d93e583708335d84158f5) by Timothée Mazzucotelli). [Issue-17](https://github.com/mkdocstrings/python/issues/17) + +### Bug Fixes + +- Render enumeration instance name instead of just "value", allowing proper cross-reference ([11d81d8](https://github.com/mkdocstrings/python/commit/11d81d8e056b7c074eb3a1c47606867156a338fa) by Timothée Mazzucotelli). [Issue-124](https://github.com/mkdocstrings/python/issues/124) + ## [1.9.2](https://github.com/mkdocstrings/python/releases/tag/1.9.2) - 2024-04-02 [Compare with 1.9.1](https://github.com/mkdocstrings/python/compare/1.9.1...1.9.2) From da02284f96cb9bcd412ca34864c569672b949f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Wed, 24 Apr 2024 14:56:41 +0200 Subject: [PATCH 007/171] style: Improve templates indentation --- .../templates/material/_base/attribute.html | 124 ++++----- .../templates/material/_base/children.html | 56 ++--- .../templates/material/_base/class.html | 236 +++++++++--------- .../material/_base/docstring/attributes.html | 148 +++++------ .../material/_base/docstring/classes.html | 102 ++++---- .../material/_base/docstring/functions.html | 116 ++++----- .../material/_base/docstring/modules.html | 102 ++++---- .../_base/docstring/other_parameters.html | 148 +++++------ .../material/_base/docstring/parameters.html | 194 +++++++------- .../material/_base/docstring/raises.html | 134 +++++----- .../material/_base/docstring/receives.html | 166 ++++++------ .../material/_base/docstring/returns.html | 166 ++++++------ .../material/_base/docstring/warns.html | 134 +++++----- .../material/_base/docstring/yields.html | 166 ++++++------ .../templates/material/_base/function.html | 154 ++++++------ .../templates/material/_base/module.html | 118 ++++----- .../templates/material/_base/signature.html | 81 +++--- .../readthedocs/docstring/returns.html | 42 ++-- 18 files changed, 1193 insertions(+), 1194 deletions(-) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html index 3f1d887e..80a75fc9 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html @@ -1,80 +1,80 @@ {{ log.debug("Rendering " + attribute.path) }}
                        -{% with obj = attribute, html_id = attribute.path %} + {% with obj = attribute, html_id = attribute.path %} - {% if root %} - {% set show_full_path = config.show_root_full_path %} - {% set root_members = True %} - {% elif root_members %} - {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} - {% set root_members = False %} - {% else %} - {% set show_full_path = config.show_object_full_path %} - {% endif %} + {% if root %} + {% set show_full_path = config.show_root_full_path %} + {% set root_members = True %} + {% elif root_members %} + {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} + {% set root_members = False %} + {% else %} + {% set show_full_path = config.show_object_full_path %} + {% endif %} + + {% set attribute_name = attribute.path if show_full_path else attribute.name %} + + {% if not root or config.show_root_heading %} + {% filter heading( + heading_level, + role="data" if attribute.parent.kind.value == "module" else "attr", + id=html_id, + class="doc doc-heading", + toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name, + ) %} - {% set attribute_name = attribute.path if show_full_path else attribute.name %} + {% block heading scoped %} + {% if config.show_symbol_type_heading %}{% endif %} + {% if config.separate_signature %} + {{ attribute_name }} + {% else %} + {%+ filter highlight(language="python", inline=True) %} + {{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %} + {% if attribute.value %} = {{ attribute.value }}{% endif %} + {% endfilter %} + {% endif %} + {% endblock heading %} - {% if not root or config.show_root_heading %} - {% filter heading( - heading_level, - role="data" if attribute.parent.kind.value == "module" else "attr", - id=html_id, - class="doc doc-heading", - toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name, - ) %} + {% block labels scoped %} + {% with labels = attribute.labels %} + {% include "labels.html" with context %} + {% endwith %} + {% endblock labels %} + + {% endfilter %} - {% block heading scoped %} - {% if config.show_symbol_type_heading %}{% endif %} + {% block signature scoped %} {% if config.separate_signature %} - {{ attribute_name }} - {% else %} - {%+ filter highlight(language="python", inline=True) %} - {{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %} - {% if attribute.value %} = {{ attribute.value }}{% endif %} + {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %} + {{ attribute.name }} {% endfilter %} {% endif %} - {% endblock heading %} + {% endblock signature %} - {% block labels scoped %} - {% with labels = attribute.labels %} - {% include "labels.html" with context %} - {% endwith %} - {% endblock labels %} + {% else %} - {% endfilter %} - - {% block signature scoped %} - {% if config.separate_signature %} - {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %} - {{ attribute.name }} + {% if config.show_root_toc_entry %} + {% filter heading(heading_level, + role="data" if attribute.parent.kind.value == "module" else "attr", + id=html_id, + toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name, + hidden=True, + ) %} {% endfilter %} {% endif %} - {% endblock signature %} - - {% else %} - - {% if config.show_root_toc_entry %} - {% filter heading(heading_level, - role="data" if attribute.parent.kind.value == "module" else "attr", - id=html_id, - toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name, - hidden=True, - ) %} - {% endfilter %} + {% set heading_level = heading_level - 1 %} {% endif %} - {% set heading_level = heading_level - 1 %} - {% endif %} -
                        - {% block contents scoped %} - {% block docstring scoped %} - {% with docstring_sections = attribute.docstring.parsed %} - {% include "docstring.html" with context %} - {% endwith %} - {% endblock docstring %} - {% endblock contents %} -
                        +
                        + {% block contents scoped %} + {% block docstring scoped %} + {% with docstring_sections = attribute.docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} + {% endblock docstring %} + {% endblock contents %} +
                        -{% endwith %} + {% endwith %}
                        diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html b/src/mkdocstrings_handlers/python/templates/material/_base/children.html index 25534f70..cd9a8fac 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html @@ -20,11 +20,11 @@ {% endif %} {% with attributes = obj.attributes|filter_objects( - filters=config.filters, - members_list=members_list, - inherited_members=config.inherited_members, - keep_no_docstrings=config.show_if_no_docstring, - ) %} + filters=config.filters, + members_list=members_list, + inherited_members=config.inherited_members, + keep_no_docstrings=config.show_if_no_docstring, + ) %} {% if attributes %} {% if config.show_category_heading %} {% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %} @@ -40,11 +40,11 @@ {% endwith %} {% with classes = obj.classes|filter_objects( - filters=config.filters, - members_list=members_list, - inherited_members=config.inherited_members, - keep_no_docstrings=config.show_if_no_docstring, - ) %} + filters=config.filters, + members_list=members_list, + inherited_members=config.inherited_members, + keep_no_docstrings=config.show_if_no_docstring, + ) %} {% if classes %} {% if config.show_category_heading %} {% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %} @@ -60,11 +60,11 @@ {% endwith %} {% with functions = obj.functions|filter_objects( - filters=config.filters, - members_list=members_list, - inherited_members=config.inherited_members, - keep_no_docstrings=config.show_if_no_docstring, - ) %} + filters=config.filters, + members_list=members_list, + inherited_members=config.inherited_members, + keep_no_docstrings=config.show_if_no_docstring, + ) %} {% if functions %} {% if config.show_category_heading %} {% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %} @@ -83,11 +83,11 @@ {% if config.show_submodules %} {% with modules = obj.modules|filter_objects( - filters=config.filters, - members_list=members_list, - inherited_members=config.inherited_members, - keep_no_docstrings=config.show_if_no_docstring, - ) %} + filters=config.filters, + members_list=members_list, + inherited_members=config.inherited_members, + keep_no_docstrings=config.show_if_no_docstring, + ) %} {% if modules %} {% if config.show_category_heading %} {% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %} @@ -108,14 +108,14 @@ {% else %} {% for child in obj.all_members - |filter_objects( - filters=config.filters, - members_list=members_list, - inherited_members=config.inherited_members, - keep_no_docstrings=config.show_if_no_docstring, - ) - |order_members(config.members_order, members_list) - %} + |filter_objects( + filters=config.filters, + members_list=members_list, + inherited_members=config.inherited_members, + keep_no_docstrings=config.show_if_no_docstring, + ) + |order_members(config.members_order, members_list) + %} {% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html b/src/mkdocstrings_handlers/python/templates/material/_base/class.html index fb7ca764..2934c7c0 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html @@ -1,142 +1,142 @@ {{ log.debug("Rendering " + class.path) }}
                        -{% with obj = class, html_id = class.path %} + {% with obj = class, html_id = class.path %} - {% if root %} - {% set show_full_path = config.show_root_full_path %} - {% set root_members = True %} - {% elif root_members %} - {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} - {% set root_members = False %} - {% else %} - {% set show_full_path = config.show_object_full_path %} - {% endif %} - - {% set class_name = class.path if show_full_path else class.name %} + {% if root %} + {% set show_full_path = config.show_root_full_path %} + {% set root_members = True %} + {% elif root_members %} + {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} + {% set root_members = False %} + {% else %} + {% set show_full_path = config.show_object_full_path %} + {% endif %} - {% if not root or config.show_root_heading %} - {% filter heading( - heading_level, - role="class", - id=html_id, - class="doc doc-heading", - toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name, - ) %} + {% set class_name = class.path if show_full_path else class.name %} - {% block heading scoped %} - {% if config.show_symbol_type_heading %}{% endif %} - {% if config.separate_signature %} - {{ class_name }} - {% elif config.merge_init_into_class and "__init__" in class.all_members %} - {% with function = class.all_members["__init__"] %} - {%+ filter highlight(language="python", inline=True) %} - {{ class_name }}{% include "signature.html" with context %} - {% endfilter %} - {% endwith %} - {% else %} - {{ class_name }} - {% endif %} - {% endblock heading %} - - {% block labels scoped %} - {% with labels = class.labels %} - {% include "labels.html" with context %} - {% endwith %} - {% endblock labels %} + {% if not root or config.show_root_heading %} + {% filter heading( + heading_level, + role="class", + id=html_id, + class="doc doc-heading", + toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name, + ) %} - {% endfilter %} + {% block heading scoped %} + {% if config.show_symbol_type_heading %}{% endif %} + {% if config.separate_signature %} + {{ class_name }} + {% elif config.merge_init_into_class and "__init__" in class.all_members %} + {% with function = class.all_members["__init__"] %} + {%+ filter highlight(language="python", inline=True) %} + {{ class_name }}{% include "signature.html" with context %} + {% endfilter %} + {% endwith %} + {% else %} + {{ class_name }} + {% endif %} + {% endblock heading %} - {% block signature scoped %} - {% if config.separate_signature and config.merge_init_into_class %} - {% if "__init__" in class.all_members %} - {% with function = class.all_members["__init__"] %} - {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} - {{ class.name }} - {% endfilter %} + {% block labels scoped %} + {% with labels = class.labels %} + {% include "labels.html" with context %} {% endwith %} - {% endif %} - {% endif %} - {% endblock signature %} + {% endblock labels %} - {% else %} - {% if config.show_root_toc_entry %} - {% filter heading(heading_level, - role="class", - id=html_id, - toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name, - hidden=True, - ) %} {% endfilter %} - {% endif %} - {% set heading_level = heading_level - 1 %} - {% endif %} - -
                        - {% block contents scoped %} - {% block bases scoped %} - {% if config.show_bases and class.bases %} -

                        - Bases: {% for expression in class.bases -%} - {% include "expression.html" with context %}{% if not loop.last %}, {% endif %} - {% endfor -%} -

                        - {% endif %} - {% endblock bases %} - {% block docstring scoped %} - {% with docstring_sections = class.docstring.parsed %} - {% include "docstring.html" with context %} - {% endwith %} - {% if config.merge_init_into_class %} - {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %} - {% with docstring_sections = class.all_members["__init__"].docstring.parsed %} - {% include "docstring.html" with context %} + {% block signature scoped %} + {% if config.separate_signature and config.merge_init_into_class %} + {% if "__init__" in class.all_members %} + {% with function = class.all_members["__init__"] %} + {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} + {{ class.name }} + {% endfilter %} {% endwith %} {% endif %} {% endif %} - {% endblock docstring %} + {% endblock signature %} + + {% else %} + {% if config.show_root_toc_entry %} + {% filter heading(heading_level, + role="class", + id=html_id, + toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name, + hidden=True, + ) %} + {% endfilter %} + {% endif %} + {% set heading_level = heading_level - 1 %} + {% endif %} - {% block source scoped %} - {% if config.show_source %} +
                        + {% block contents scoped %} + {% block bases scoped %} + {% if config.show_bases and class.bases %} +

                        + Bases: {% for expression in class.bases -%} + {% include "expression.html" with context %}{% if not loop.last %}, {% endif %} + {% endfor -%} +

                        + {% endif %} + {% endblock bases %} + + {% block docstring scoped %} + {% with docstring_sections = class.docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} {% if config.merge_init_into_class %} - {% if "__init__" in class.all_members and class.all_members["__init__"].source %} - {% with init = class.all_members["__init__"] %} -
                        - Source code in - {%- if init.relative_filepath.is_absolute() -%} - {{ init.relative_package_filepath }} - {%- else -%} - {{ init.relative_filepath }} - {%- endif -%} - - {{ init.source|highlight(language="python", linestart=init.lineno, linenums=True) }} -
                        + {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %} + {% with docstring_sections = class.all_members["__init__"].docstring.parsed %} + {% include "docstring.html" with context %} {% endwith %} {% endif %} - {% elif class.source %} -
                        - Source code in - {%- if class.relative_filepath.is_absolute() -%} - {{ class.relative_package_filepath }} - {%- else -%} - {{ class.relative_filepath }} - {%- endif -%} - - {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }} -
                        {% endif %} - {% endif %} - {% endblock source %} + {% endblock docstring %} + + {% block source scoped %} + {% if config.show_source %} + {% if config.merge_init_into_class %} + {% if "__init__" in class.all_members and class.all_members["__init__"].source %} + {% with init = class.all_members["__init__"] %} +
                        + Source code in + {%- if init.relative_filepath.is_absolute() -%} + {{ init.relative_package_filepath }} + {%- else -%} + {{ init.relative_filepath }} + {%- endif -%} + + {{ init.source|highlight(language="python", linestart=init.lineno, linenums=True) }} +
                        + {% endwith %} + {% endif %} + {% elif class.source %} +
                        + Source code in + {%- if class.relative_filepath.is_absolute() -%} + {{ class.relative_package_filepath }} + {%- else -%} + {{ class.relative_filepath }} + {%- endif -%} + + {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }} +
                        + {% endif %} + {% endif %} + {% endblock source %} - {% block children scoped %} - {% set root = False %} - {% set heading_level = heading_level + 1 %} - {% include "children.html" with context %} - {% endblock children %} - {% endblock contents %} -
                        + {% block children scoped %} + {% set root = False %} + {% set heading_level = heading_level + 1 %} + {% include "children.html" with context %} + {% endblock children %} + {% endblock contents %} +
                        -{% endwith %} + {% endwith %}
                        diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html index 771a9eed..99824653 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html @@ -4,87 +4,87 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                        {{ section.title or lang.t("Attributes:") }}

                        - - - - - - - - - - {% for attribute in section.value %} - - - - +

                        {{ section.title or lang.t("Attributes:") }}

                        +
                        {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
                        {{ attribute.name }} - {% if attribute.annotation %} - {% with expression = attribute.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
                        - {{ attribute.description|convert_markdown(heading_level, html_id) }} -
                        -
                        + + + + + - {% endfor %} - -
                        {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
                        + +
                        {{ attribute.name }} + {% if attribute.annotation %} + {% with expression = attribute.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
                        + {{ attribute.description|convert_markdown(heading_level, html_id) }} +
                        +
                        {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                        {{ section.title or lang.t("Attributes:") }}

                        -
                          - {% for attribute in section.value %} -
                        • - {{ attribute.name }} - {% if attribute.annotation %} - {% with expression = attribute.annotation %} - ({% include "expression.html" with context %}) - {% endwith %} - {% endif %} - – -
                          - {{ attribute.description|convert_markdown(heading_level, html_id) }} -
                          -
                        • - {% endfor %} -
                        +

                        {{ section.title or lang.t("Attributes:") }}

                        +
                          + {% for attribute in section.value %} +
                        • + {{ attribute.name }} + {% if attribute.annotation %} + {% with expression = attribute.annotation %} + ({% include "expression.html" with context %}) + {% endwith %} + {% endif %} + – +
                          + {{ attribute.description|convert_markdown(heading_level, html_id) }} +
                          +
                        • + {% endfor %} +
                        {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for attribute in section.value %} - - - +
                        {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                        {{ attribute.name }} -
                        - {{ attribute.description|convert_markdown(heading_level, html_id) }} -
                        -

                        - {% if attribute.annotation %} - - TYPE: - {% with expression = attribute.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} -

                        -
                        + + + + - {% endfor %} - -
                        {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                        + +
                      {{ attribute.name }} +
                      + {{ attribute.description|convert_markdown(heading_level, html_id) }} +
                      +

                      + {% if attribute.annotation %} + + TYPE: + {% with expression = attribute.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} +

                      +
                      {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html index 054cf5af..c0acac8a 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html @@ -4,64 +4,64 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                      {{ section.title or lang.t("Classes:") }}

                      - - - - - - - - - {% for class in section.value %} - - - +

                      {{ section.title or lang.t("Classes:") }}

                      +
                      {{ lang.t("Name") }}{{ lang.t("Description") }}
                      {{ class.name }} -
                      - {{ class.description|convert_markdown(heading_level, html_id) }} -
                      -
                      + + + + - {% endfor %} - -
                      {{ lang.t("Name") }}{{ lang.t("Description") }}
                      + +
                      {{ class.name }} +
                      + {{ class.description|convert_markdown(heading_level, html_id) }} +
                      +
                      {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                      {{ section.title or lang.t("Classes:") }}

                      -
                        - {% for class in section.value %} -
                      • - {{ class.name }} - – -
                        - {{ class.description|convert_markdown(heading_level, html_id) }} -
                        -
                      • - {% endfor %} -
                      +

                      {{ section.title or lang.t("Classes:") }}

                      +
                        + {% for class in section.value %} +
                      • + {{ class.name }} + – +
                        + {{ class.description|convert_markdown(heading_level, html_id) }} +
                        +
                      • + {% endfor %} +
                      {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for class in section.value %} - - - +
                      {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                      {{ class.name }} -
                      - {{ class.description|convert_markdown(heading_level, html_id) }} -
                      -
                      + + + + - {% endfor %} - -
                      {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                      + +
                    {{ class.name }} +
                    + {{ class.description|convert_markdown(heading_level, html_id) }} +
                    +
                    {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html index a16917bd..696826f0 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html @@ -4,70 +4,70 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                    {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

                    - - - - - - - - - {% for function in section.value %} - {% if not function.name == "__init__" or not config.merge_init_into_class %} - - - - - {% endif %} - {% endfor %} - -
                    {{ lang.t("Name") }}{{ lang.t("Description") }}
                    {{ function.name }} -
                    - {{ function.description|convert_markdown(heading_level, html_id) }} -
                    -
                    +

                    {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

                    + + + + + + + + + {% for function in section.value %} + {% if not function.name == "__init__" or not config.merge_init_into_class %} + + + + + {% endif %} + {% endfor %} + +
                    {{ lang.t("Name") }}{{ lang.t("Description") }}
                    {{ function.name }} +
                    + {{ function.description|convert_markdown(heading_level, html_id) }} +
                    +
                    {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                    {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

                    -
                      - {% for function in section.value %} - {% if not function.name == "__init__" or not config.merge_init_into_class %} -
                    • - {{ function.name }} - – -
                      - {{ function.description|convert_markdown(heading_level, html_id) }} -
                      -
                    • - {% endif %} - {% endfor %} -
                    - {% endblock list_style %} -{% elif config.docstring_section_style == "spacy" %} - {% block spacy_style scoped %} - - - - - - - - +

                    {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}

                    +
                      {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %} -
                    - - - +
                  • + {{ function.name }} + – +
                    + {{ function.description|convert_markdown(heading_level, html_id) }} +
                    +
                  • {% endif %} {% endfor %} - -
                    {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                    {{ function.name }} -
                    - {{ function.description|convert_markdown(heading_level, html_id) }} -
                    -
                    + + {% endblock list_style %} +{% elif config.docstring_section_style == "spacy" %} + {% block spacy_style scoped %} + + + + + + + + + {% for function in section.value %} + {% if not function.name == "__init__" or not config.merge_init_into_class %} + + + + + {% endif %} + {% endfor %} + +
                    {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                    {{ function.name }} +
                    + {{ function.description|convert_markdown(heading_level, html_id) }} +
                    +
                    {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html index 26b38257..d5ea77e6 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html @@ -4,64 +4,64 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                    {{ section.title or lang.t("Modules:") }}

                    - - - - - - - - - {% for module in section.value %} - - - +

                    {{ section.title or lang.t("Modules:") }}

                    +
                    {{ lang.t("Name") }}{{ lang.t("Description") }}
                    {{ module.name }} -
                    - {{ module.description|convert_markdown(heading_level, html_id) }} -
                    -
                    + + + + - {% endfor %} - -
                    {{ lang.t("Name") }}{{ lang.t("Description") }}
                    + +
                    {{ module.name }} +
                    + {{ module.description|convert_markdown(heading_level, html_id) }} +
                    +
                    {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                    {{ section.title or lang.t("Modules:") }}

                    -
                      - {% for module in section.value %} -
                    • - {{ module.name }} - – -
                      - {{ module.description|convert_markdown(heading_level, html_id) }} -
                      -
                    • - {% endfor %} -
                    +

                    {{ section.title or lang.t("Modules:") }}

                    +
                      + {% for module in section.value %} +
                    • + {{ module.name }} + – +
                      + {{ module.description|convert_markdown(heading_level, html_id) }} +
                      +
                    • + {% endfor %} +
                    {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for module in section.value %} - - - +
                    {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                    {{ module.name }} -
                    - {{ module.description|convert_markdown(heading_level, html_id) }} -
                    -
                    + + + + - {% endfor %} - -
                    {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                    + +
                  {{ module.name }} +
                  + {{ module.description|convert_markdown(heading_level, html_id) }} +
                  +
                  {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html index f31836a8..17d6d355 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html @@ -4,87 +4,87 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                  {{ section.title or lang.t("Other Parameters:") }}

                  - - - - - - - - - - {% for parameter in section.value %} - - - - +

                  {{ section.title or lang.t("Other Parameters:") }}

                  +
                  {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
                  {{ parameter.name }} - {% if parameter.annotation %} - {% with expression = parameter.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
                  - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
                  -
                  + + + + + - {% endfor %} - -
                  {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
                  + +
                  {{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
                  + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
                  +
                  {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                  {{ section.title or lang.t("Other Parameters:") }}

                  -
                    - {% for parameter in section.value %} -
                  • - {{ parameter.name }} - {% if parameter.annotation %} - {% with expression = parameter.annotation %} - ({% include "expression.html" with context %}) - {% endwith %} - {% endif %} - – -
                    - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
                    -
                  • - {% endfor %} -
                  +

                  {{ section.title or lang.t("Other Parameters:") }}

                  +
                    + {% for parameter in section.value %} +
                  • + {{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + ({% include "expression.html" with context %}) + {% endwith %} + {% endif %} + – +
                    + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
                    +
                  • + {% endfor %} +
                  {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for parameter in section.value %} - - - +
                  {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                  {{ parameter.name }} -
                  - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
                  -

                  - {% if parameter.annotation %} - - {{ lang.t("TYPE:") }} - {% with expression = parameter.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} -

                  -
                  + + + + - {% endfor %} - -
                  {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                  + +
                {{ parameter.name }} +
                + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
                +

                + {% if parameter.annotation %} + + {{ lang.t("TYPE:") }} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} +

                +
                {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html index 05bdadee..7980096d 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html @@ -4,110 +4,110 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

                {{ section.title or lang.t("Parameters:") }}

                - - - - - - - - - - - {% for parameter in section.value %} - - - - - +

                {{ section.title or lang.t("Parameters:") }}

                +
                {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}{{ lang.t("Default") }}
                {{ parameter.name }} - {% if parameter.annotation %} - {% with expression = parameter.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
                - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
                -
                - {% if parameter.default %} - {% with expression = parameter.default %} - {% include "expression.html" with context %} - {% endwith %} - {% else %} - {{ lang.t("required") }} - {% endif %} -
                + + + + + + - {% endfor %} - -
                {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}{{ lang.t("Default") }}
                + +
                {{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
                + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
                +
                + {% if parameter.default %} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% else %} + {{ lang.t("required") }} + {% endif %} +
                {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

                {{ section.title or lang.t("Parameters:") }}

                -
                  - {% for parameter in section.value %} -
                • - {{ parameter.name }} - {% if parameter.annotation %} - {% with expression = parameter.annotation %} - ({% include "expression.html" with context %} - {%- if parameter.default %}, {{ lang.t("default:") }} - {% with expression = parameter.default %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %}) - {% endwith %} - {% endif %} - – -
                  - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
                  -
                • - {% endfor %} -
                +

                {{ section.title or lang.t("Parameters:") }}

                +
                  + {% for parameter in section.value %} +
                • + {{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + ({% include "expression.html" with context %} + {%- if parameter.default %}, {{ lang.t("default:") }} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %}) + {% endwith %} + {% endif %} + – +
                  + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
                  +
                • + {% endfor %} +
                {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for parameter in section.value %} - - - +
                {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                {{ parameter.name }} -
                - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
                -

                - {% if parameter.annotation %} - - {{ lang.t("TYPE:") }} - {% with expression = parameter.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} - {% if parameter.default %} - - {{ lang.t("DEFAULT:") }} - {% with expression = parameter.default %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} -

                -
                + + + + - {% endfor %} - -
                {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
                + +
              {{ parameter.name }} +
              + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
              +

              + {% if parameter.annotation %} + + {{ lang.t("TYPE:") }} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} + {% if parameter.default %} + + {{ lang.t("DEFAULT:") }} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} +

              +
              {% endblock spacy_style %} {% endif %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html index 5e20b653..8240dc09 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html @@ -4,80 +4,80 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

              {{ section.title or lang.t("Raises:") }}

              - - - - - - - - - {% for raises in section.value %} - - - +

              {{ section.title or lang.t("Raises:") }}

              +
              {{ lang.t("Type") }}{{ lang.t("Description") }}
              - {% if raises.annotation %} - {% with expression = raises.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
              - {{ raises.description|convert_markdown(heading_level, html_id) }} -
              -
              + + + + - {% endfor %} - -
              {{ lang.t("Type") }}{{ lang.t("Description") }}
              + +
              + {% if raises.annotation %} + {% with expression = raises.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
              + {{ raises.description|convert_markdown(heading_level, html_id) }} +
              +
              {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

              {{ lang.t(section.title) or lang.t("Raises:") }}

              -
                - {% for raises in section.value %} -
              • - {% if raises.annotation %} - {% with expression = raises.annotation %} - {% include "expression.html" with context %} - {% endwith %} - – - {% endif %} -
                - {{ raises.description|convert_markdown(heading_level, html_id) }} -
                -
              • - {% endfor %} -
              +

              {{ lang.t(section.title) or lang.t("Raises:") }}

              +
                + {% for raises in section.value %} +
              • + {% if raises.annotation %} + {% with expression = raises.annotation %} + {% include "expression.html" with context %} + {% endwith %} + – + {% endif %} +
                + {{ raises.description|convert_markdown(heading_level, html_id) }} +
                +
              • + {% endfor %} +
              {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for raises in section.value %} - - - +
              {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
              - - {% with expression = raises.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - -
              - {{ raises.description|convert_markdown(heading_level, html_id) }} -
              -
              + + + + - {% endfor %} - -
              {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
              + +
            + + {% with expression = raises.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + +
            + {{ raises.description|convert_markdown(heading_level, html_id) }} +
            +
            {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html index e03e8b8e..1eff98ae 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html @@ -4,100 +4,100 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} - {% set name_column = section.value|selectattr("name")|any %} -

            {{ section.title or lang.t("Receives:") }}

            - - - - {% if name_column %}{% endif %} - - - - - - {% for receives in section.value %} - - {% if name_column %}{% endif %} - - + {% set name_column = section.value|selectattr("name")|any %} +

            {{ section.title or lang.t("Receives:") }}

            +
            {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
            {% if receives.name %}{{ receives.name }}{% endif %} - {% if receives.annotation %} - {% with expression = receives.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
            - {{ receives.description|convert_markdown(heading_level, html_id) }} -
            -
            + + + {% if name_column %}{% endif %} + + - {% endfor %} - -
            {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
            + +
            {% if receives.name %}{{ receives.name }}{% endif %} + {% if receives.annotation %} + {% with expression = receives.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
            + {{ receives.description|convert_markdown(heading_level, html_id) }} +
            +
            {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

            {{ section.title or lang.t("Receives:") }}

            -
              - {% for receives in section.value %} -
            • - {% if receives.name %}{{ receives.name }}{% endif %} - {% if receives.annotation %} - {% with expression = receives.annotation %} - {% if receives.name %} ({% endif %} - {% include "expression.html" with context %} - {% if receives.name %}){% endif %} - {% endwith %} - {% endif %} - – -
              - {{ receives.description|convert_markdown(heading_level, html_id) }} -
              -
            • - {% endfor %} -
            +

            {{ section.title or lang.t("Receives:") }}

            +
              + {% for receives in section.value %} +
            • + {% if receives.name %}{{ receives.name }}{% endif %} + {% if receives.annotation %} + {% with expression = receives.annotation %} + {% if receives.name %} ({% endif %} + {% include "expression.html" with context %} + {% if receives.name %}){% endif %} + {% endwith %} + {% endif %} + – +
              + {{ receives.description|convert_markdown(heading_level, html_id) }} +
              +
            • + {% endfor %} +
            {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for receives in section.value %} - - - + + + {% endfor %} + +
            {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
            - {% if receives.name %} - {{ receives.name }} - {% elif receives.annotation %} - - {% with expression = receives.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} - -
            - {{ receives.description|convert_markdown(heading_level, html_id) }} -
            - {% if receives.name and receives.annotation %} -

            + + + + + + + + + {% for receives in section.value %} + + - - {% endfor %} - -
            {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
            + {% if receives.name %} + {{ receives.name }} + {% elif receives.annotation %} - {{ lang.t("TYPE:") }} {% with expression = receives.annotation %} {% include "expression.html" with context %} {% endwith %} -

            - {% endif %} -
            + {% endif %} +

            +
            + {{ receives.description|convert_markdown(heading_level, html_id) }} +
            + {% if receives.name and receives.annotation %} +

            + + {{ lang.t("TYPE:") }} + {% with expression = receives.annotation %} + {% include "expression.html" with context %} + {% endwith %} + +

            + {% endif %} +
            {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html index a7a7cb98..bf3bdb4b 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html @@ -4,100 +4,100 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} - {% set name_column = section.value|selectattr("name")|any %} -

            {{ section.title or lang.t("Returns:") }}

            - - - - {% if name_column %}{% endif %} - - - - - - {% for returns in section.value %} - - {% if name_column %}{% endif %} - - + {% set name_column = section.value|selectattr("name")|any %} +

            {{ section.title or lang.t("Returns:") }}

            +
            {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
            {% if returns.name %}{{ returns.name }}{% endif %} - {% if returns.annotation %} - {% with expression = returns.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
            - {{ returns.description|convert_markdown(heading_level, html_id) }} -
            -
            + + + {% if name_column %}{% endif %} + + - {% endfor %} - -
            {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
            + +
          {% if returns.name %}{{ returns.name }}{% endif %} + {% if returns.annotation %} + {% with expression = returns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
          + {{ returns.description|convert_markdown(heading_level, html_id) }} +
          +
          {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

          {{ section.title or lang.t("Returns:") }}

          -
            - {% for returns in section.value %} -
          • - {% if returns.name %}{{ returns.name }}{% endif %} - {% if returns.annotation %} - {% with expression = returns.annotation %} - {% if returns.name %} ({% endif %} - {% include "expression.html" with context %} - {% if returns.name %}){% endif %} - {% endwith %} - {% endif %} - – -
            - {{ returns.description|convert_markdown(heading_level, html_id) }} -
            -
          • - {% endfor %} -
          +

          {{ section.title or lang.t("Returns:") }}

          +
            + {% for returns in section.value %} +
          • + {% if returns.name %}{{ returns.name }}{% endif %} + {% if returns.annotation %} + {% with expression = returns.annotation %} + {% if returns.name %} ({% endif %} + {% include "expression.html" with context %} + {% if returns.name %}){% endif %} + {% endwith %} + {% endif %} + – +
            + {{ returns.description|convert_markdown(heading_level, html_id) }} +
            +
          • + {% endfor %} +
          {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for returns in section.value %} - - - + + + {% endfor %} + +
          {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION").upper() }}
          - {% if returns.name %} - {{ returns.name }} - {% elif returns.annotation %} - - {% with expression = returns.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} - -
          - {{ returns.description|convert_markdown(heading_level, html_id) }} -
          - {% if returns.name and returns.annotation %} -

          + + + + + + + + + {% for returns in section.value %} + + - - {% endfor %} - -
          {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION").upper() }}
          + {% if returns.name %} + {{ returns.name }} + {% elif returns.annotation %} - {{ lang.t("TYPE:") }} {% with expression = returns.annotation %} {% include "expression.html" with context %} {% endwith %} -

          - {% endif %} -
          + {% endif %} +

          +
          + {{ returns.description|convert_markdown(heading_level, html_id) }} +
          + {% if returns.name and returns.annotation %} +

          + + {{ lang.t("TYPE:") }} + {% with expression = returns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + +

          + {% endif %} +
          {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html index a9bdae26..f7883a7a 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html @@ -4,80 +4,80 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} -

          {{ section.title or lang.t("Warns:") }}

          - - - - - - - - - {% for warns in section.value %} - - - +

          {{ section.title or lang.t("Warns:") }}

          +
          {{ lang.t("Type") }}{{ lang.t("Description") }}
          - {% if warns.annotation %} - {% with expression = warns.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
          - {{ warns.description|convert_markdown(heading_level, html_id) }} -
          -
          + + + + - {% endfor %} - -
          {{ lang.t("Type") }}{{ lang.t("Description") }}
          + +
          + {% if warns.annotation %} + {% with expression = warns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
          + {{ warns.description|convert_markdown(heading_level, html_id) }} +
          +
          {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

          {{ section.title or lang.t("Warns:") }}

          -
            - {% for warns in section.value %} -
          • - {% if warns.annotation %} - {% with expression = warns.annotation %} - {% include "expression.html" with context %} - {% endwith %} - – - {% endif %} -
            - {{ warns.description|convert_markdown(heading_level, html_id) }} -
            -
          • - {% endfor %} -
          +

          {{ section.title or lang.t("Warns:") }}

          +
            + {% for warns in section.value %} +
          • + {% if warns.annotation %} + {% with expression = warns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + – + {% endif %} +
            + {{ warns.description|convert_markdown(heading_level, html_id) }} +
            +
          • + {% endfor %} +
          {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for warns in section.value %} - - - +
          {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
          - - {% with expression = warns.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - -
          - {{ warns.description|convert_markdown(heading_level, html_id) }} -
          -
          + + + + - {% endfor %} - -
          {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
          + +
        + + {% with expression = warns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + +
        + {{ warns.description|convert_markdown(heading_level, html_id) }} +
        +
        {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html index 6c4cb0b0..2a4bb734 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html @@ -4,100 +4,100 @@ {% if config.docstring_section_style == "table" %} {% block table_style scoped %} - {% set name_column = section.value|selectattr("name")|any %} -

        {{ section.title or lang.t("Yields:") }}

        - - - - {% if name_column %}{% endif %} - - - - - - {% for yields in section.value %} - - {% if name_column %}{% endif %} - - + {% set name_column = section.value|selectattr("name")|any %} +

        {{ section.title or lang.t("Yields:") }}

        +
        {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
        {% if yields.name %}{{ yields.name }}{% endif %} - {% if yields.annotation %} - {% with expression = yields.annotation %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %} - -
        - {{ yields.description|convert_markdown(heading_level, html_id) }} -
        -
        + + + {% if name_column %}{% endif %} + + - {% endfor %} - -
        {{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
        + +
        {% if yields.name %}{{ yields.name }}{% endif %} + {% if yields.annotation %} + {% with expression = yields.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
        + {{ yields.description|convert_markdown(heading_level, html_id) }} +
        +
        {% endblock table_style %} {% elif config.docstring_section_style == "list" %} {% block list_style scoped %} -

        {{ section.title or lang.t("Yields:") }}

        -
          - {% for yields in section.value %} -
        • - {% if yields.name %}{{ yields.name }}{% endif %} - {% if yields.annotation %} - {% with expression = yields.annotation %} - {% if yields.name %} ({% endif %} - {% include "expression.html" with context %} - {% if yields.name %}){% endif %} - {% endwith %} - {% endif %} - – -
          - {{ yields.description|convert_markdown(heading_level, html_id) }} -
          -
        • - {% endfor %} -
        +

        {{ section.title or lang.t("Yields:") }}

        +
          + {% for yields in section.value %} +
        • + {% if yields.name %}{{ yields.name }}{% endif %} + {% if yields.annotation %} + {% with expression = yields.annotation %} + {% if yields.name %} ({% endif %} + {% include "expression.html" with context %} + {% if yields.name %}){% endif %} + {% endwith %} + {% endif %} + – +
          + {{ yields.description|convert_markdown(heading_level, html_id) }} +
          +
        • + {% endfor %} +
        {% endblock list_style %} {% elif config.docstring_section_style == "spacy" %} {% block spacy_style scoped %} - - - - - - - - - {% for yields in section.value %} - - - + + + {% endfor %} + +
        {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
        - {% if yields.name %} - {{ yields.name }} - {% elif yields.annotation %} - - {% with expression = yields.annotation %} - {% include "expression.html" with context %} - {% endwith %} - - {% endif %} - -
        - {{ yields.description|convert_markdown(heading_level, html_id) }} -
        - {% if yields.name and yields.annotation %} -

        + + + + + + + + + {% for yields in section.value %} + + - - {% endfor %} - -
        {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
        + {% if yields.name %} + {{ yields.name }} + {% elif yields.annotation %} - {{ lang.t("TYPE:") }}: {% with expression = yields.annotation %} {% include "expression.html" with context %} {% endwith %} -

        - {% endif %} -
        + {% endif %} +

        +
        + {{ yields.description|convert_markdown(heading_level, html_id) }} +
        + {% if yields.name and yields.annotation %} +

        + + {{ lang.t("TYPE:") }}: + {% with expression = yields.annotation %} + {% include "expression.html" with context %} + {% endwith %} + +

        + {% endif %} +
        {% endblock spacy_style %} {% endif %} \ No newline at end of file diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html b/src/mkdocstrings_handlers/python/templates/material/_base/function.html index 5c2ac29e..c4a20a12 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html @@ -3,96 +3,96 @@ {% import "language.html" as lang with context %}
        -{% with obj = function, html_id = function.path %} + {% with obj = function, html_id = function.path %} - {% if root %} - {% set show_full_path = config.show_root_full_path %} - {% set root_members = True %} - {% elif root_members %} - {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} - {% set root_members = False %} - {% else %} - {% set show_full_path = config.show_object_full_path %} - {% endif %} + {% if root %} + {% set show_full_path = config.show_root_full_path %} + {% set root_members = True %} + {% elif root_members %} + {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} + {% set root_members = False %} + {% else %} + {% set show_full_path = config.show_object_full_path %} + {% endif %} + + {% set function_name = function.path if show_full_path else function.name %} + {% set symbol_type = "method" if function.parent.is_class else "function" %} + + {% if not root or config.show_root_heading %} + {% filter heading( + heading_level, + role="function", + id=html_id, + class="doc doc-heading", + toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name, + ) %} - {% set function_name = function.path if show_full_path else function.name %} - {% set symbol_type = "method" if function.parent.is_class else "function" %} + {% block heading scoped %} + {% if config.show_symbol_type_heading %}{% endif %} + {% if config.separate_signature %} + {{ function_name }} + {% else %} + {%+ filter highlight(language="python", inline=True) %} + {{ function_name }}{% include "signature.html" with context %} + {% endfilter %} + {% endif %} + {% endblock heading %} - {% if not root or config.show_root_heading %} - {% filter heading( - heading_level, - role="function", - id=html_id, - class="doc doc-heading", - toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name, - ) %} + {% block labels scoped %} + {% with labels = function.labels %} + {% include "labels.html" with context %} + {% endwith %} + {% endblock labels %} + + {% endfilter %} - {% block heading scoped %} - {% if config.show_symbol_type_heading %}{% endif %} + {% block signature scoped %} {% if config.separate_signature %} - {{ function_name }} - {% else %} - {%+ filter highlight(language="python", inline=True) %} - {{ function_name }}{% include "signature.html" with context %} + {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} + {{ function.name }} {% endfilter %} {% endif %} - {% endblock heading %} + {% endblock signature %} - {% block labels scoped %} - {% with labels = function.labels %} - {% include "labels.html" with context %} - {% endwith %} - {% endblock labels %} + {% else %} - {% endfilter %} - - {% block signature scoped %} - {% if config.separate_signature %} - {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} - {{ function.name }} + {% if config.show_root_toc_entry %} + {% filter heading( + heading_level, + role="function", + id=html_id, + toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name, + hidden=True, + ) %} {% endfilter %} {% endif %} - {% endblock signature %} - - {% else %} - - {% if config.show_root_toc_entry %} - {% filter heading( - heading_level, - role="function", - id=html_id, - toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name, - hidden=True, - ) %} - {% endfilter %} + {% set heading_level = heading_level - 1 %} {% endif %} - {% set heading_level = heading_level - 1 %} - {% endif %} -
        - {% block contents scoped %} - {% block docstring scoped %} - {% with docstring_sections = function.docstring.parsed %} - {% include "docstring.html" with context %} - {% endwith %} - {% endblock docstring %} +
        + {% block contents scoped %} + {% block docstring scoped %} + {% with docstring_sections = function.docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} + {% endblock docstring %} - {% block source scoped %} - {% if config.show_source and function.source %} -
        - {{ lang.t("Source code in") }} - {%- if function.relative_filepath.is_absolute() -%} - {{ function.relative_package_filepath }} - {%- else -%} - {{ function.relative_filepath }} - {%- endif -%} - - {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} -
        - {% endif %} - {% endblock source %} - {% endblock contents %} -
        + {% block source scoped %} + {% if config.show_source and function.source %} +
        + {{ lang.t("Source code in") }} + {%- if function.relative_filepath.is_absolute() -%} + {{ function.relative_package_filepath }} + {%- else -%} + {{ function.relative_filepath }} + {%- endif -%} + + {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} +
        + {% endif %} + {% endblock source %} + {% endblock contents %} +
        -{% endwith %} + {% endwith %}
        diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html b/src/mkdocstrings_handlers/python/templates/material/_base/module.html index 7d45e321..5c3080c6 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html @@ -1,74 +1,74 @@ {{ log.debug("Rendering " + module.path) }}
        -{% with obj = module, html_id = module.path %} + {% with obj = module, html_id = module.path %} - {% if root %} - {% set show_full_path = config.show_root_full_path %} - {% set root_members = True %} - {% elif root_members %} - {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} - {% set root_members = False %} - {% else %} - {% set show_full_path = config.show_object_full_path %} - {% endif %} - - {% set module_name = module.path if show_full_path else module.name %} - - {% if not root or config.show_root_heading %} - {% filter heading( - heading_level, - role="module", - id=html_id, - class="doc doc-heading", - toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name, - ) %} - - {% block heading scoped %} - {% if config.show_symbol_type_heading %}{% endif %} - {% if config.separate_signature %} - {{ module_name }} - {% else %} - {{ module_name }} - {% endif %} - {% endblock heading %} - - {% block labels scoped %} - {% with labels = module.labels %} - {% include "labels.html" with context %} - {% endwith %} - {% endblock labels %} + {% if root %} + {% set show_full_path = config.show_root_full_path %} + {% set root_members = True %} + {% elif root_members %} + {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} + {% set root_members = False %} + {% else %} + {% set show_full_path = config.show_object_full_path %} + {% endif %} - {% endfilter %} + {% set module_name = module.path if show_full_path else module.name %} - {% else %} - {% if config.show_root_toc_entry %} - {% filter heading(heading_level, + {% if not root or config.show_root_heading %} + {% filter heading( + heading_level, role="module", id=html_id, + class="doc doc-heading", toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name, - hidden=True, - ) %} + ) %} + + {% block heading scoped %} + {% if config.show_symbol_type_heading %}{% endif %} + {% if config.separate_signature %} + {{ module_name }} + {% else %} + {{ module_name }} + {% endif %} + {% endblock heading %} + + {% block labels scoped %} + {% with labels = module.labels %} + {% include "labels.html" with context %} + {% endwith %} + {% endblock labels %} + {% endfilter %} + + {% else %} + {% if config.show_root_toc_entry %} + {% filter heading(heading_level, + role="module", + id=html_id, + toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name, + hidden=True, + ) %} + {% endfilter %} + {% endif %} + {% set heading_level = heading_level - 1 %} {% endif %} - {% set heading_level = heading_level - 1 %} - {% endif %} -
        - {% block contents scoped %} - {% block docstring scoped %} - {% with docstring_sections = module.docstring.parsed %} - {% include "docstring.html" with context %} - {% endwith %} - {% endblock docstring %} +
        + {% block contents scoped %} + {% block docstring scoped %} + {% with docstring_sections = module.docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} + {% endblock docstring %} - {% block children scoped %} - {% set root = False %} - {% set heading_level = heading_level + 1 %} - {% include "children.html" with context %} - {% endblock children %} - {% endblock contents %} -
        + {% block children scoped %} + {% set root = False %} + {% set heading_level = heading_level + 1 %} + {% include "children.html" with context %} + {% endblock children %} + {% endblock contents %} +
        -{% endwith %} + {% endwith %}
        diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html index 74563385..6d3d2973 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html @@ -3,62 +3,61 @@ {%- with -%} {%- set ns = namespace( - has_pos_only=False, - render_pos_only_separator=True, - render_kw_only_separator=True, - annotation="", - equal="=", - ) - -%} + has_pos_only=False, + render_pos_only_separator=True, + render_kw_only_separator=True, + annotation="", + equal="=", + ) -%} ( - {%- for parameter in function.parameters -%} - {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%} + {%- for parameter in function.parameters -%} + {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%} - {%- if parameter.kind.value == "positional-only" -%} - {%- set ns.has_pos_only = True -%} - {%- else -%} - {%- if ns.has_pos_only and ns.render_pos_only_separator -%} - {%- set ns.render_pos_only_separator = False %}/, {% endif -%} - {%- if parameter.kind.value == "keyword-only" -%} - {%- if ns.render_kw_only_separator -%} - {%- set ns.render_kw_only_separator = False %}*, {% endif -%} - {%- endif -%} + {%- if parameter.kind.value == "positional-only" -%} + {%- set ns.has_pos_only = True -%} + {%- else -%} + {%- if ns.has_pos_only and ns.render_pos_only_separator -%} + {%- set ns.render_pos_only_separator = False %}/, {% endif -%} + {%- if parameter.kind.value == "keyword-only" -%} + {%- if ns.render_kw_only_separator -%} + {%- set ns.render_kw_only_separator = False %}*, {% endif -%} {%- endif -%} + {%- endif -%} - {%- if config.show_signature_annotations and parameter.annotation is not none -%} - {%- set ns.equal = " = " -%} - {%- if config.separate_signature and config.signature_crossrefs -%} - {%- with expression = parameter.annotation -%} - {%- set ns.annotation -%}: {% include "expression.html" with context %}{%- endset -%} - {%- endwith -%} - {%- else -%} - {%- set ns.annotation = ": " + parameter.annotation|safe -%} - {%- endif -%} + {%- if config.show_signature_annotations and parameter.annotation is not none -%} + {%- set ns.equal = " = " -%} + {%- if config.separate_signature and config.signature_crossrefs -%} + {%- with expression = parameter.annotation -%} + {%- set ns.annotation -%}: {% include "expression.html" with context %}{%- endset -%} + {%- endwith -%} {%- else -%} - {%- set ns.equal = "=" -%} - {%- set ns.annotation = "" -%} + {%- set ns.annotation = ": " + parameter.annotation|safe -%} {%- endif -%} + {%- else -%} + {%- set ns.equal = "=" -%} + {%- set ns.annotation = "" -%} + {%- endif -%} - {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%} - {%- set default = ns.equal + parameter.default|safe -%} - {%- endif -%} + {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%} + {%- set default = ns.equal + parameter.default|safe -%} + {%- endif -%} - {%- if parameter.kind.value == "variadic positional" -%} - {%- set ns.render_kw_only_separator = False -%} - {%- endif -%} + {%- if parameter.kind.value == "variadic positional" -%} + {%- set ns.render_kw_only_separator = False -%} + {%- endif -%} - {% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%} - {{ parameter.name }}{{ ns.annotation }}{{ default }} - {%- if not loop.last %}, {% endif -%} + {% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%} + {{ parameter.name }}{{ ns.annotation }}{{ default }} + {%- if not loop.last %}, {% endif -%} - {%- endif -%} - {%- endfor -%} + {%- endif -%} + {%- endfor -%} ) {%- if config.show_signature_annotations and function.annotation and not (config.merge_init_into_class and function.name == "__init__" ) - %} -> {% if config.separate_signature and config.signature_crossrefs -%} + %} -> {% if config.separate_signature and config.signature_crossrefs -%} {%- with expression = function.annotation %}{% include "expression.html" with context %}{%- endwith -%} {%- else -%} {{ function.annotation|safe }} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html index c2300318..355eedcc 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html @@ -9,27 +9,27 @@
      {{ section.title or lang.t("Returns:") }} -
        - {% for returns in section.value %} -
      • - {% if returns.name %}{{ returns.name }}{% endif %} - {% if returns.annotation %} - {% with expression = returns.annotation %} - {% if returns.name %}({% endif %} - {% include "expression.html" with context %} - {% if returns.name %}){% endif %} - {% endwith %} - {% endif %} - – -
        - {{ returns.description|convert_markdown(heading_level, html_id) }} -
        -
      • - {% endfor %} -
      -
      {{ section.title or lang.t("Returns:") }} +
        + {% for returns in section.value %} +
      • + {% if returns.name %}{{ returns.name }}{% endif %} + {% if returns.annotation %} + {% with expression = returns.annotation %} + {% if returns.name %}({% endif %} + {% include "expression.html" with context %} + {% if returns.name %}){% endif %} + {% endwith %} + {% endif %} + – +
        + {{ returns.description|convert_markdown(heading_level, html_id) }} +
        +
      • + {% endfor %} +
      +
      From 2bc156bd6f231ae13066651f4490d1e9c2ce3ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 28 Apr 2024 14:40:11 +0200 Subject: [PATCH 008/171] build: Depend on mkdocstrings 0.25 which adds support for parameter `once` when logging messages --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c02461f1..398d5d3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "mkdocstrings>=0.24.2", + "mkdocstrings>=0.25", "griffe>=0.44", ] From 26e3d66f5334a5aaff75bda030afe6dfa1cc94d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 28 Apr 2024 14:42:09 +0200 Subject: [PATCH 009/171] refactor: Log a warning when base templates are overridden Issue-151: https://github.com/mkdocstrings/python/issues/151 --- src/mkdocstrings_handlers/python/handler.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py index fa8e384c..03111005 100644 --- a/src/mkdocstrings_handlers/python/handler.py +++ b/src/mkdocstrings_handlers/python/handler.py @@ -9,6 +9,7 @@ import sys from collections import ChainMap from contextlib import suppress +from pathlib import Path from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar, Iterator, Mapping, Sequence from griffe.collections import LinesCollection, ModulesCollection @@ -208,6 +209,17 @@ def __init__( **kwargs: Same thing, but with keyword arguments. """ super().__init__(*args, **kwargs) + + # Warn if user overrides base templates. + if custom_templates := kwargs.get("custom_templates", ()): + config_dir = Path(config_file_path or "./mkdocs.yml").parent + for theme_dir in config_dir.joinpath(custom_templates, "python").iterdir(): + if theme_dir.joinpath("_base").is_dir(): + logger.warning( + f"Overriding base template '{theme_dir.name}/_base/