Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ repos:
hooks:
- id: pyproject-fmt
groups: [format]
- repo: https://github.com/djlint/djLint
rev: v1.46.2
hooks:
- id: djlint-reformat
- id: djlint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.8
rev: v0.16.9
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
Expand Down Expand Up @@ -51,7 +56,6 @@ repos:
# Check that there are no merge conflicts (could be generated by template sync)
- id: check-merge-conflict
args: [--assume-in-merge]

- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.30.1
hooks:
Expand Down
12 changes: 12 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
],
},
"formatter": { "useEditorconfig": true },
"javascript": {
"formatter": {
"semicolons": "asNeeded",
},
},
"overrides": [
{
"includes": ["./.vscode/*.json", "**/*.jsonc"],
Expand All @@ -21,5 +26,12 @@
},
},
},
// HTML formatting is opt-in; most templates contain Jinja inside tags, which Biome can't parse.
{
"includes": [
"src/scverse_doc/theme/scverse/components/sidebar-versions.html",
],
"html": { "formatter": { "enabled": true } },
},
],
}
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ envs.hatch-test.overrides.matrix.deps.env-vars = [
envs.hatch-test.default-args = []
envs.hatch-test.dependency-groups = [ "dev", "test" ]

[tool.djlint]
indent = 2
single_attribute_per_line = true

[tool.ruff]
line-length = 120
src = [ "src" ]
Expand Down
54 changes: 27 additions & 27 deletions src/scverse_doc/theme/scverse/components/scverse-ecosystem.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
without any package touching its own conf.py.
-#}
{%- if theme_show_ecosystem_dropdown | tobool and scverse_ecosystem -%}
<div class="dropdown scverse-ecosystem-dropdown">
<button
class="btn dropdown-toggle nav-link"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false"
aria-label="{{ _('scverse packages') }}"
>
{{ _("scverse packages") }}
</button>
<ul class="dropdown-menu dropdown-menu-end">
{%- for group, label in [("core", _("Core")), ("ecosystem", _("Ecosystem"))] %}
{%- if scverse_ecosystem[group] %}
<li><h6 class="dropdown-header">{{ label }}</h6></li>
{%- for pkg in scverse_ecosystem[group] %}
<li>
<a
class="dropdown-item{% if pkg.current %} active{% endif %}"
href="{{ pkg.docs }}"
{% if pkg.current %}aria-current="page"{% endif %}
>{{ pkg.name }}</a>
</li>
{%- endfor %}
{%- endif %}
{%- endfor %}
</ul>
</div>
<div class="dropdown scverse-ecosystem-dropdown">
<button
class="btn dropdown-toggle nav-link"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false"
aria-label="{{ _("scverse packages") }}"
>{{ _("scverse packages") }}</button>
<ul class="dropdown-menu dropdown-menu-end">
{%- for group, label in [("core", _("Core")), ("ecosystem", _("Ecosystem"))] %}
{%- if scverse_ecosystem[group] %}
<li>
<h6 class="dropdown-header">{{ label }}</h6>
</li>
{%- for pkg in scverse_ecosystem[group] %}
<li>
<a
class="dropdown-item{% if pkg.current %} active{% endif %}"
href="{{ pkg.docs }}"
{% if pkg.current %}aria-current="page"{% endif %}
>{{ pkg.name }}</a>
</li>
{%- endfor %}
{%- endif %}
{%- endfor %}
</ul>
</div>
{%- endif -%}
10 changes: 4 additions & 6 deletions src/scverse_doc/theme/scverse/components/scverse-footer.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
{#- Shared footer: the boilerplate every scverse README already carries, rendered identically on every docs site. -#}
<div class="scverse-footer-brand">
<span>
{%- if show_copyright and copyright %}&copy; {{ copyright }}{% endif -%}
</span>
<span>{%- if show_copyright and copyright %}© {{ copyright }}{% endif -%}</span>
<span>
<a href="https://scverse.org/">scverse</a> is a
<a href="https://numfocus.org/">NumFOCUS</a> affiliated project.
</span>
<span>
<a href="https://scverse.org/about/roles/">Governance</a>
&middot;
·
<a href="https://discourse.scverse.org/">Discourse</a>
&middot;
·
<a href="https://scverse.org/join/">Get involved</a>
</span>
{%- if last_updated %}
<span>{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}</span>
<span>{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}</span>
{%- endif %}
</div>
20 changes: 20 additions & 0 deletions src/scverse_doc/theme/scverse/components/sidebar-versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<readthedocs-flyout></readthedocs-flyout>
<script type="module">
// flyout.css hardcodes `.container { position: fixed }` with no part/variable to override it,
// and the logo is an <img> of a #fcfcfc SVG (made for dark backgrounds): dim it to the grey RTD uses for its icons
customElements.whenDefined("readthedocs-flyout").then(() => {
const sheet = new CSSStyleSheet()
sheet.replaceSync(`
.container { position: static; max-width: none; max-height: none; }
header > img.logo { filter: brightness(0.5); }
`)
for (const { shadowRoot } of document.querySelectorAll(
"readthedocs-flyout",
)) {
shadowRoot.adoptedStyleSheets = [
...shadowRoot.adoptedStyleSheets,
sheet,
]
}
})
</script>
5 changes: 5 additions & 0 deletions src/scverse_doc/theme/scverse/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{%- extends "pydata_sphinx_theme/layout.html" %}
{%- block extrahead %}
{{ super() }}
<meta name="readthedocs-addons-api-version" content="1" />
{%- endblock %}
23 changes: 23 additions & 0 deletions src/scverse_doc/theme/scverse/static/styles/scverse.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ html {
}
}

/* --- Sidebar ------------------------------------------------------------ */

/* pydata hides the sidebar when it has no toctree (e.g. the root page), but the version selector should stay */
@media (min-width: 960px) {
.bd-sidebar-primary.hide-on-wide:has(readthedocs-flyout) {
display: flex;
}
}
.sidebar-primary-item:has(> :only-child:empty) {
display: none;
}
.sidebar-primary-item readthedocs-flyout {
--readthedocs-flyout-background-color: transparent;
--readthedocs-flyout-font-family: inherit;
--readthedocs-flyout-divider-color: var(--scverse-color-border);
--readthedocs-flyout-color: var(--scverse-color-text-muted);
--readthedocs-flyout-section-heading-color: var(--scverse-color-text-muted);
--readthedocs-flyout-link-color: var(--pst-color-link-higher-contrast);
--readthedocs-flyout-item-link-color: var(--pst-color-link);

padding: 0;
}

/* --- Cards -------------------------------------------------------------- */

/* .bd-content exists to beat sphinx-design in selector specificity */
Expand Down
26 changes: 0 additions & 26 deletions src/scverse_doc/theme/scverse/theme.conf

This file was deleted.

28 changes: 28 additions & 0 deletions src/scverse_doc/theme/scverse/theme.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[theme]
inherit = "pydata_sphinx_theme"
stylesheets = [
"styles/scverse.css",
]
pygments_style = { default = "tango" }

[options]
package = ""
accent = ""
show_ecosystem_dropdown = "True"
navbar_align = "left"
navbar_start = "navbar-logo"
navbar_center = "navbar-nav"
navbar_end = "scverse-ecosystem, theme-switcher, navbar-icon-links"
navbar_persistent = "search-button"
primary_sidebar_end = ["sidebar-ethical-ads", "sidebar-versions"]
secondary_sidebar_items = ["page-toc", "edit-this-page", "sourcelink"]
footer_start = "scverse-footer"
footer_center = ""
footer_end = ""
show_nav_level = "0"
show_toc_level = "2"
navigation_depth = "3"
collapse_navigation = "False"
pygments_light_style = "tango"
pygments_dark_style = "monokai"
announcement = "https://scverse.org/announcement.html"
Loading