diff --git a/.github/workflows/quarto-docs.yaml b/.github/workflows/quarto-docs.yaml index 286d39287..4cfdabaac 100644 --- a/.github/workflows/quarto-docs.yaml +++ b/.github/workflows/quarto-docs.yaml @@ -26,6 +26,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} - name: Install poetry run: pipx install poetry @@ -53,6 +55,5 @@ jobs: default_author: github_actions message: "Generate quarto docs" add: "docs/" - remove: "docs/_build/" pathspec_error_handling: ignore push: true diff --git a/docs/templates/custom.css b/docs/templates/custom.css deleted file mode 100644 index e1b5017ef..000000000 --- a/docs/templates/custom.css +++ /dev/null @@ -1,15 +0,0 @@ -nav.pdoc { - background: #F8FAFC; - box-shadow: none; - border-right: 1px solid #dee2e6; - width: clamp(10rem, 18rem, 22rem); -} - -nav input { - margin-top: 40px; - padding: 4px; - appearance: none; - background: white; - border: 1px solid #dee2e6; - border-radius: 4px; -} diff --git a/docs/templates/module.html.jinja2 b/docs/templates/module.html.jinja2 deleted file mode 100644 index ccef49e48..000000000 --- a/docs/templates/module.html.jinja2 +++ /dev/null @@ -1,310 +0,0 @@ -{% extends "frame.html.jinja2" %} -{% block title %}{{ module.modulename }} API documentation{% endblock %} -{% block nav %} - {% block module_list_link %} - {% set parentmodule = ".".join(module.modulename.split(".")[:-1]) %} - {% if parentmodule and parentmodule in all_modules %} - - {% include "resources/box-arrow-in-left.svg" %} -   - {{- parentmodule -}} - - {% elif not root_module_name %} - - {% include "resources/box-arrow-in-left.svg" %} -   - Module Index - - {% endif %} - {% endblock %} - - {% block nav_title %} - {% if logo %} - {% if logo_link %}{% endif %} - - {% if logo_link %}{% endif %} - {% endif %} - {% endblock %} - - {% block search_box %} - {% if search and all_modules|length > 1 %} - {# we set a pattern here so that we can use the :valid CSS selector #} - - {% endif %} - {% endblock %} - - {% block nav_index %} - {% set index = module.docstring | to_markdown | to_html | attr("toc_html") %} - {% if index %} -

Contents

- {{ index | safe }} - {% endif %} - {% endblock %} - - {% block nav_members %} - {% if module.members %} -

Python Library API

- {{ nav_members(module.members.values()) }} - {% endif %} - {% endblock %} - - {% block nav_submodules %} - {% if module.submodules %} -

Submodules

- - {% endif %} - {% endblock %} - - {% block nav_footer %} - {% if footer_text %} - - {% endif %} - {% endblock %} - - {% block attribution %} - - built with pdocpdoc logo - - {% endblock %} -{% endblock nav %} -{% block content %} -
- {% block module_info %} -
- {% block edit_button %} - {% if edit_url %} - {% if "github.com" in edit_url %} - {% set edit_text = "Edit on GitHub" %} - {% elif "gitlab" in edit_url %} - {% set edit_text = "Edit on GitLab" %} - {% else %} - {% set edit_text = "Edit Source" %} - {% endif %} - {{ edit_text }} - {% endif %} - {% endblock %} - {{ module_name() }} - {{ docstring(module) }} - {{ view_source_state(module) }} - {{ view_source_button(module) }} - {{ view_source_code(module) }} -
- {% endblock %} - {% block module_contents %} - {% for m in module.flattened_own_members if is_public(m) | trim %} -
- {{ member(m) }} - {% if m.kind == "class" %} - {% for m in m.own_members if m.kind != "class" and is_public(m) | trim %} -
- {{ member(m) }} -
- {% endfor %} - {% set inherited_members = inherited(m) | trim %} - {% if inherited_members %} -
-
Inherited Members
-
- {{ inherited_members }} -
-
- {% endif %} - {% endif %} -
- {% endfor %} - {% endblock %} -
- {% if mtime %} - {% include "livereload.html.jinja2" %} - {% endif %} - {% block search_js %} - {% if search and all_modules|length > 1 %} - {% include "search.html.jinja2" %} - {% endif %} - {% endblock %} -{% endblock content %} -{# -End of content, beginning of helper macros. -See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an explanation of defaultmacro. -#} -{% defaultmacro bases(cls) %} - {%- if cls.bases -%} - ( - {%- for base in cls.bases -%} - {{ base[:2] | link(text=base[2]) }} - {%- if loop.nextitem %}, {% endif %} - {%- endfor -%} - ) - {%- endif -%} -{% enddefaultmacro %} -{% defaultmacro default_value(var) -%} - {%- if var.default_value_str %} - = - {% if var.default_value_str | length > 100 -%} - - - {%- endif -%} - {{ var.default_value_str | escape | linkify }} - {%- endif -%} -{% enddefaultmacro %} -{% defaultmacro annotation(var) %} - {%- if var.annotation_str -%} - {{ var.annotation_str | escape | linkify }} - {%- endif -%} -{% enddefaultmacro %} -{% defaultmacro decorators(doc) %} - {% for d in doc.decorators if not d.startswith("@_") %} -
{{ d }}
- {% endfor %} -{% enddefaultmacro %} -{% defaultmacro function(fn) -%} - {{ decorators(fn) }} - {% if fn.name == "__init__" %} - {{ ".".join(fn.qualname.split(".")[:-1]) }} - {{- fn.signature_without_self | format_signature(colon=False) | linkify }} - {% else %} - {{ fn.funcdef }} - {{ fn.name }} - {{- fn.signature | format_signature(colon=True) | linkify }} - {% endif %} -{% enddefaultmacro %} -{% defaultmacro variable(var) -%} - {{ var.name }}{{ annotation(var) }}{{ default_value(var) }} -{% enddefaultmacro %} -{% defaultmacro submodule(mod) -%} - {{ mod.taken_from | link }} -{% enddefaultmacro %} -{% defaultmacro class(cls) -%} - {{ decorators(cls) }} - class - {{ cls.qualname }} - {{- bases(cls) -}}: -{% enddefaultmacro %} -{% defaultmacro member(doc) %} - {{- view_source_state(doc) -}} -
- {% if doc.kind == "class" %} - {{ class(doc) }} - {% elif doc.kind == "function" %} - {{ function(doc) }} - {% elif doc.kind == "module" %} - {{ submodule(doc) }} - {% else %} - {{ variable(doc) }} - {% endif %} - {{ view_source_button(doc) }} -
- - {{ view_source_code(doc) }} - {{ docstring(doc) }} -{% enddefaultmacro %} -{% defaultmacro docstring(var) %} - {% if var.docstring %} -
{{ var.docstring | to_markdown | to_html | linkify(namespace=var.qualname) }}
- {% endif %} -{% enddefaultmacro %} -{% defaultmacro nav_members(members) %} - -{% enddefaultmacro %} -{% defaultmacro is_public(doc) %} - {# - This macro is a bit unconventional in that its output is not rendered, but treated as a boolean: - Returning no text is interpreted as false, returning any other text is iterpreted as true. - Implementing this as a macro makes it very easy to override with a custom template, see - https://github.com/mitmproxy/pdoc/tree/main/examples/custom-template. - #} - {% if doc.name == "__init__" and (doc.docstring or (doc.kind == "function" and doc.signature_without_self.parameters)) %} - {# show constructors that have a docstring or at least one extra argument #} - true - {% elif doc.name == "__doc__" %} - {# We don't want to document __doc__ itself, https://github.com/mitmproxy/pdoc/issues/235 #} - {% elif doc.kind == "module" and doc.fullname not in all_modules %} - {# Skip modules that were manually excluded, https://github.com/mitmproxy/pdoc/issues/334 #} - {% elif (doc.qualname or doc.name) is in(module.obj.__all__ or []) %} - {# members starting with an underscore are still public if mentioned in __all__ #} - true - {% elif not doc.name.startswith("_") and (doc.kind != "variable" or doc.is_enum_member or doc.docstring) %} - {# members not starting with an underscore are considered public by default #} - true - {% endif %} -{% enddefaultmacro %} -{# fmt: off #} -{% defaultmacro inherited(cls) %} - {% for base, members in cls.inherited_members.items() %} - {% set m = None %}{# workaround for https://github.com/pallets/jinja/issues/1427 #} - {% set member_html %} - {% for m in members if is_public(m) | trim %} -
- {{- m.taken_from | link(text=m.name.replace("__init__",base[1])) -}} -
- {% endfor %} - {% endset %} - {# we may not have any public members, in which case we don't want to print anything. #} - {% if member_html %} -
{{ base | link }}
- {{ member_html }} -
- {% endif %} - {% endfor %} -{% enddefaultmacro %} -{# fmt: on #} -{% defaultmacro view_source_state(doc) %} - {% if show_source and doc.source %} - - {% endif %} -{% enddefaultmacro %} -{% defaultmacro view_source_button(doc) %} - {% if show_source and doc.source %} - - {% endif %} -{% enddefaultmacro %} -{% defaultmacro view_source_code(doc) %} - {% if show_source and doc.source %} - {{ doc | highlight }} - {% endif %} -{% enddefaultmacro %} -{% defaultmacro module_name() %} -

- {% if module.name == "validmind" %} - ValidMind Library - {% else %} - {% set parts = module.modulename.split(".") %} - {% for part in parts %} - {%- set fullname = ".".join(parts[:loop.index]) -%} - {%- if fullname in all_modules and fullname != module.modulename -%} - {{ part }} - {%- else -%} - {{ part }} - {%- endif -%} - {%- if loop.nextitem -%} - . - {%- endif -%} - {% endfor %} - {% endif %} -

-{% enddefaultmacro %}