mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH 3/3] doc: custom.css: fix "View Page Source" align with newer sphinx_rtd_theme
Date: Sat,  6 May 2023 22:22:23 +0200	[thread overview]
Message-ID: <20230506202223.263380-3-rhi@pengutronix.de> (raw)
In-Reply-To: <20230506202223.263380-1-rhi@pengutronix.de>

sphinx_rtd_theme PR #1073, which went into 1.2.0, removed the
vertical-align attribute for the "View Page Source" link, which does not
have a big impact on the vanilla sphinx_rtd_theme. However our custom
theme hacks add buttons left and right of the breadcrumbs which are
higher than the line height, and therefore our custom.css already
includes a "vertical-align: middle" to align the text of the chapter
marks with the surrounding buttons. However, this doesn't work for the
.wy-breadcrumbs-aside elements, which get floated right; therefore they
get rendered as "display: block" instead of "display: inline-block", and
according to the CSS specification, the "vertical-align" has no effect
on "display: block" elements. This has the effect that the "View Source"
link is now no longer aligned vertically, but instead is shifted upwards
relative to the baseline of the chapter marks.

The right way to have left-aligned chapter marks and right-aligned "View
Source" link would probably be a flex layout, but that would need
another layer of <div>s to group the left and right elements of the
navigation header, which we cannot do here as we only have control over
the CSS and not the page structure. Instead, re-apply the display and
padding that were removed in PR #1073 (and increase the padding to 7px
to account for or higher buttons), which does approximately the right
thing, and re-aligns the "View Source" link with the baseline of the
chapter marks again.

This has no effect on sphinx_rtd_theme < 1.2.0 since the a element and
the surrounding .wy-breadcrumbs-aside will be of the same height.

Link: https://github.com/readthedocs/sphinx_rtd_theme/pull/1073
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 doc/_static/css/custom.css | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css
index 7efe0e101774..27add44263d5 100644
--- a/doc/_static/css/custom.css
+++ b/doc/_static/css/custom.css
@@ -12,6 +12,11 @@
     vertical-align: middle;
 }
 
+/* "View Page Source" link */
+.wy-breadcrumbs .wy-breadcrumbs-aside > a {
+    display: inline-block;
+    padding: 7px;
+}
 
 /* links */
 .wy-menu-vertical a:active {
-- 
2.39.2




  parent reply	other threads:[~2023-05-06 20:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06 20:22 [ptxdist] [PATCH 1/3] doc: fix CSS/JS files not getting picked up by sphinx 5.3.0 Roland Hieber
2023-05-06 20:22 ` [ptxdist] [PATCH 2/3] doc: custom.css: fix indentation Roland Hieber
2023-05-11  5:55   ` [ptxdist] [APPLIED] " Michael Olbrich
2023-05-06 20:22 ` Roland Hieber [this message]
2023-05-11  5:55   ` [ptxdist] [APPLIED] doc: custom.css: fix "View Page Source" align with newer sphinx_rtd_theme Michael Olbrich
2023-05-11  5:55 ` [ptxdist] [APPLIED] doc: fix CSS/JS files not getting picked up by sphinx 5.3.0 Michael Olbrich
2023-05-15 10:21 ` [ptxdist] [PATCH 1/3] " Jonas Schmidt
2023-05-15 11:18   ` Gavin Schenk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230506202223.263380-3-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox