css: Work around Pygments' element layout changes

Pygments 2.12 changes the element layout slightly, adding a wrapper
<div> that was accidentally removed before:
https://github.com/pygments/pygments/issues/632.

This patch adds a workaround, so the styling is consistent on both 2.11
and 2.12.
This commit is contained in:
Alberto Bertogli 2022-09-26 02:43:55 +01:00
parent 6ea59bad51
commit dff4ff6757
3 changed files with 21 additions and 7 deletions

@ -268,21 +268,31 @@ table.blob-binary tr.etc {
/* Pygments overrides. */
div.colorized-src {
font-size: larger;
}
div.colorized-src .source_code {
/* Ignore pygments style's background. */
background: var(--body-bg);
}
td.code > div.source_code {
/* This is a workaround, in pygments 2.11 there's a bug where the wrapper
* div is inside the table, so we need to override the descendant (because
* the style sets it on ".source_code" and the most specific value wins).
* Once we no longer support 2.11, we can remove this. */
background: var(--body-bg);
}
div.linenodiv {
padding-right: 0.5em;
font-size: larger;
/* must match div.source_code */
}
div.linenodiv a {
color: var(--text-lowcontrast-fg);
}
div.source_code {
background: inherit;
font-size: larger;
}
/* Repository information table. */
table.repo_info tr:hover {

@ -77,7 +77,9 @@
{{!markdown_blob(blob.utf8_content)}}
</div>
% elif can_colorize(blob.utf8_content):
<div class="colorized-src">
{{!colorize_blob(fname.raw, blob.utf8_content)}}
</div>
% else:
<pre class="blob-body">
{{blob.utf8_content}}

@ -56,7 +56,9 @@
<hr/>
% if can_colorize(c.diff.body):
<div class="colorized-src">
{{!colorize_diff(c.diff.body)}}
</div>
% else:
<pre class="diff-body">
{{c.diff.body}}