Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork66
Use consistent line-height for light & dark theme#227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -328,6 +328,10 @@ tt, code, pre { | |||
font-size: 96.5%; | |||
} | |||
pre { | |||
line-height: 125%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
To keep the initial value for the theme, rather than the overridden one:
line-height:125%; | |
line-height:120%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I have to check later if this will work or if we need a more specific selector sincepygments_dark.css
is included last and sets125%
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It was indeed the case. I went fordiv.body pre
to increase the specificity and overridepygments_dark.css
06987c2
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
While working on the copy button, I noticed the line height of the
pre
element differs for the light and dark theme. It is set to120%
for the light theme125%
for the dark theme, which is not a huge difference but it's better to be consistent.The reason for the discrepancy is the order in which the css is included in the

<head>
. For the light theme,classic.css
takes precedence:Whereas for the dark theme, it is

pygments_dark.css
which is the last stylesheet in the<head>
:This seems to be related to how sphinx inserts the css for pygments:
https://github.com/sphinx-doc/sphinx/blob/a6d7ae16739bf92a032a7c4df0297db7cf120ec9/sphinx/builders/html/__init__.py#L258-L262
In any case, we can fix this by simply setting the line height in
pydoctheme.css
.📚 Documentation preview 📚:https://python-docs-theme-previews--227.org.readthedocs.build/