Skip to content

Commit d7abe2e

Browse files
authored
Merge pull request #3223 from A5rocks/update-docs
Update styles for documentation
2 parents 0790c45 + 01e7c23 commit d7abe2e

File tree

3 files changed

+17
-46
lines changed

3 files changed

+17
-46
lines changed

docs/source/_static/hackrtd.css renamed to docs/source/_static/styles.css

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/* Temporary hack to work around bug in rtd theme 2.0 through 2.4
2-
See https://github.com/rtfd/sphinx_rtd_theme/pull/382
3-
*/
4-
pre {
5-
line-height: normal !important;
6-
}
7-
81
/* Make .. deprecation:: blocks visible
92
* (by default they're entirely unstyled)
103
*/
@@ -23,6 +16,10 @@ pre {
2316
* thingummy also has an <hr> in it, and putting the ornament on that looks
2417
* *really weird*. (In particular, the background color is wrong.)
2518
*/
19+
.rst-content hr {
20+
overflow: visible;
21+
}
22+
2623
.rst-content hr:after {
2724
/* This .svg gets displayed on top of the middle of the hrule. It has a box
2825
* behind the logo that's colored to match the RTD theme body background
@@ -41,39 +38,21 @@ pre {
4138

4239
/* Hacks to make the upper-left logo area look nicer */
4340

44-
.wy-side-nav-search {
45-
/* Lighter background color to match logo */
46-
background-color: #d2e7fa !important;
47-
}
48-
4941
.wy-side-nav-search > a {
5042
color: #306998 !important;
5143
}
5244

53-
.wy-side-nav-search > a.logo {
54-
display: block !important;
55-
padding-bottom: 0.809em !important;
45+
/* vertically center version text */
46+
.wy-side-nav-search > a {
47+
display: flex;
48+
align-items: center;
49+
margin: auto;
50+
width: max-content;
5651
}
5752

5853
.wy-side-nav-search > a img.logo {
59-
display: inline !important;
60-
padding: 0 !important;
61-
}
62-
63-
.trio-version {
64-
display: inline;
65-
/* I *cannot* figure out how to get the version text vertically centered
66-
on the logo. Oh well...
67-
height: 32px;
68-
line-height: 32px;
69-
*/
70-
}
71-
72-
.wy-side-nav-search > a {
73-
/* Mostly this is just to simplify things, so we don't have margin/padding
74-
* on both the <a> and the <img> inside it */
75-
margin: 0 !important;
76-
padding: 0 !important;
54+
margin-left: 0;
55+
margin-right: 5px;
7756
}
7857

7958
/* Get rid of the weird super dark "Contents" label that wastes vertical space

docs/source/_templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a class="logo" href="{{ pathto(root_doc) }}">
1313
<img class="logo" src="{{ logo_url }}" />
1414
{%- set nav_version = version %}
15-
{% if READTHEDOCS and current_version %}
15+
{% if current_version %}
1616
{%- set nav_version = current_version %}
1717
{% endif %}
1818
{# don't show the version on RTD if it's the default #}

docs/source/conf.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,16 @@ def autodoc_process_signature(
167167
return signature, return_annotation
168168

169169

170-
# XX hack the RTD theme until
171-
# https://github.com/rtfd/sphinx_rtd_theme/pull/382
172-
# is shipped (should be in the release after 0.2.4)
173-
# ...note that this has since grown to contain a bunch of other CSS hacks too
174-
# though.
175170
def setup(app: Sphinx) -> None:
176-
app.add_css_file("hackrtd.css")
171+
# Add our custom styling to make our documentation better!
172+
app.add_css_file("styles.css")
177173
app.connect("autodoc-process-signature", autodoc_process_signature)
178174
# After Intersphinx runs, add additional mappings.
179175
app.connect("builder-inited", add_intersphinx, priority=1000)
180176
app.connect("source-read", on_read_source)
181177

182178

183-
# Our docs use the READTHEDOCS variable, so copied from:
184-
# https://about.readthedocs.com/blog/2024/07/addons-by-default/
185-
if os.environ.get("READTHEDOCS", "") == "True":
186-
if "html_context" not in globals():
187-
html_context = {}
188-
html_context["READTHEDOCS"] = True
179+
html_context = {"current_version": os.environ.get("READTHEDOCS_VERSION_NAME")}
189180

190181
# -- General configuration ------------------------------------------------
191182

@@ -375,6 +366,7 @@ def add_mapping(
375366
"navigation_depth": 4,
376367
"logo_only": True,
377368
"prev_next_buttons_location": "both",
369+
"style_nav_header_background": "#d2e7fa",
378370
}
379371

380372
# Add any paths that contain custom static files (such as style sheets) here,

0 commit comments

Comments
 (0)