Skip to content

Commit cce4feb

Browse files
authored
docs: update to furo theme to match Spack docs (#471)
* docs: update to furo theme to match Spack docs * Add logos * Fix images location and add versions.js * Fix block quotes for sections * Fix more block quotes * Fix more block quotes * docs: fix indentation
1 parent 106f55b commit cce4feb

15 files changed

Lines changed: 384 additions & 147 deletions

_pygments/style.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

_static/css/custom.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,44 @@
22
overflow-y: auto;
33
max-height: 700px;
44
}
5+
6+
div.versionadded {
7+
border-left: 3px solid #0c731f;
8+
color: #0c731f;
9+
padding-left: 1rem;
10+
}
11+
12+
.py.property {
13+
display: block !important;
14+
}
15+
16+
div.version-switch {
17+
text-align: center;
18+
min-height: 2em;
19+
}
20+
21+
div.version-switch>select {
22+
display: inline-block;
23+
text-align-last: center;
24+
background: none;
25+
border: none;
26+
border-radius: 0.5em;
27+
box-shadow: none;
28+
color: var(--color-foreground-primary);
29+
cursor: pointer;
30+
appearance: none;
31+
padding: 0.2em;
32+
-webkit-appearance: none;
33+
-moz-appearance: none;
34+
}
35+
36+
div.version-switch select:active,
37+
div.version-switch select:focus,
38+
div.version-switch select:hover {
39+
color: var(--color-foreground-secondary);
40+
background: var(--color-background-hover);
41+
}
42+
43+
.toc-tree li.scroll-current>.reference {
44+
font-weight: normal;
45+
}

_static/images/spack-logo-text.svg

Lines changed: 64 additions & 0 deletions
Loading
Lines changed: 64 additions & 0 deletions
Loading

_static/js/versions.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// taken from https://github.com/readthedocs/sphinx_rtd_theme/blob/3.0.2/sphinx_rtd_theme/static/js/versions.js_t
2+
3+
function onSelectorSwitch(event) {
4+
const option = event.target.selectedIndex;
5+
const item = event.target.options[option];
6+
window.location.href = item.dataset.url;
7+
}
8+
9+
document.addEventListener("readthedocs-addons-data-ready", function (event) {
10+
const config = event.detail.data();
11+
12+
const versionSwitch = document.querySelector(
13+
"div.version-switch",
14+
);
15+
let versions = config.versions.active;
16+
if (config.versions.current.hidden || config.versions.current.type === "external") {
17+
versions.unshift(config.versions.current);
18+
}
19+
const versionSelect = `
20+
<select>
21+
${versions
22+
.map(
23+
(version) => `
24+
<option
25+
value="${version.slug}"
26+
${config.versions.current.slug === version.slug ? 'selected="selected"' : ""}
27+
data-url="${version.urls.documentation}">
28+
${version.slug}
29+
</option>`,
30+
)
31+
.join("\n")}
32+
</select>
33+
`;
34+
35+
versionSwitch.innerHTML = versionSelect;
36+
versionSwitch.firstElementChild.addEventListener("change", onSelectorSwitch);
37+
})

_templates/base.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% extends "!base.html" %}
2+
3+
{%- block extrahead %}
4+
<!-- Google tag (gtag.js) -->
5+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-S0PQ7WV75K"></script>
6+
<script>
7+
window.dataLayer = window.dataLayer || [];
8+
function gtag(){dataLayer.push(arguments);}
9+
gtag('js', new Date());
10+
gtag('config', 'G-S0PQ7WV75K');
11+
</script>
12+
{%- if READTHEDOCS %}
13+
<meta name="readthedocs-addons-api-version" content="1">
14+
<script src="{{ pathto('_static/js/versions.js', 1) }}"></script>
15+
{%- endif %}
16+
{% endblock %}

_templates/sidebar/brand.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}">
2+
{%- block brand_content %}
3+
{#- Remember to update the prefetch logic in `block logo_prefetch_links` in base.html #}
4+
{%- if logo_url %}
5+
<div class="sidebar-logo-container">
6+
<img class="sidebar-logo" src="{{ logo_url }}" alt="Logo"/>
7+
</div>
8+
{%- endif %}
9+
{%- if theme_light_logo and theme_dark_logo %}
10+
<div class="sidebar-logo-container">
11+
<img class="sidebar-logo only-light" width="850" height="256" src="{{ pathto('_static/' + theme_light_logo, 1) }}" alt="Spack Logo"/>
12+
<img class="sidebar-logo only-dark" width="850" height="256" src="{{ pathto('_static/' + theme_dark_logo, 1) }}" alt="Spack Logo"/>
13+
</div>
14+
{%- endif %}
15+
{% if not theme_sidebar_hide_name %}
16+
<span class="sidebar-brand-text">{{ docstitle if docstitle else project }}</span>
17+
{%- endif %}
18+
{% endblock brand_content %}
19+
</a>
20+
21+
{%- if READTHEDOCS %}
22+
<div class="version-switch"></div>
23+
{%- endif %}

0 commit comments

Comments
 (0)