Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
AA-Turner merged 2 commits intopython:mainfromtomasr8:line-height
Apr 10, 2025

Conversation

tomasr8
Copy link
Member

@tomasr8tomasr8 commentedApr 8, 2025
edited by github-actionsbot
Loading

While working on the copy button, I noticed the line height of thepre 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:
Screenshot from 2025-04-08 22-31-31

Whereas for the dark theme, it ispygments_dark.css which is the last stylesheet in the<head>:
Screenshot from 2025-04-08 22-31-41

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 inpydoctheme.css.


📚 Documentation preview 📚:https://python-docs-theme-previews--227.org.readthedocs.build/

@@ -328,6 +328,10 @@ tt, code, pre {
font-size: 96.5%;
}

pre {
line-height: 125%;
Copy link
Member

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:

Suggested change
line-height:125%;
line-height:120%;

Copy link
MemberAuthor

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%

Copy link
MemberAuthor

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

@AA-TurnerAA-Turner merged commit06987c2 intopython:mainApr 10, 2025
14 checks passed
@tomasr8tomasr8 deleted the line-height branchApril 10, 2025 19:22
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@AA-TurnerAA-TurnerAA-Turner left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@tomasr8@AA-Turner

[8]ページ先頭

©2009-2025 Movatter.jp