Inconsistent line-height for dark/light theme #344
-
The line-height is currently inconsistent between dark and light themes: body[data-theme="dark"] .highlight pre {
line-height: 125%;
} vs. default article .highlight pre {
line-height: 1.5;
} which becomes obvious when toggling between the two. light_formatter = HtmlFormatter(style=_KNOWN_STYLES_IN_USE["light"])
dark_formatter = HtmlFormatter(style=_KNOWN_STYLES_IN_USE["dark"])
lines: List[str] = []
lines.extend(_get_styles(light_formatter, prefix=".highlight"))
dark_prefix = 'body[data-theme="dark"] .highlight'
lines.extend(_get_styles(dark_formatter, prefix=dark_prefix))
not_light_prefix = 'body:not([data-theme="light"]) .highlight'
lines.append("@media (prefers-color-scheme: dark) {")
lines.extend(_get_styles(dark_formatter, prefix=not_light_prefix))
lines.append("}") Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Hmm... What version are you on? I believe this has been fixed. |
Beta Was this translation helpful? Give feedback.
-
Fixed in 0c4018f. Will be in the next release. |
Beta Was this translation helpful? Give feedback.
-
I double-checked 0c4018f, it works pretty good, thanks! One open issue though: the line number padding is also off. I had to additionally override it like this: article[role=main] {
.highlight span.linenos {
color: inherit;
background-color: transparent;
padding-left: 0.875rem;
padding-right: 0.875rem;
}
} So I guess this part of _code.sass needs to be adjusted as well here: // When `html_codeblock_linenos_style` is inline.
.highlight
span.linenos
display: inline-block
padding-left: 0
padding-right: $code-spacing-horizontal
margin-right: $code-spacing-horizontal
box-shadow: -0.0625rem 0 var(--color-foreground-border) inset
|
Beta Was this translation helpful? Give feedback.
Fixed in 0c4018f. Will be in the next release.