I've been experimenting with using pygments to do syntax highlighting. This works fine, except I can't choose the style to use. I learned that pygments can output the CSS that controls the formatting and colors. For my example, I'm using |pygmentize -S style -f html| to get the CSS.

I added the CSS to the CSS file but the colors don't change. It turns out that what texinfo outputs from pygments is missing the class property for all of the pygments output.

For example, the html file contains

|<pre class="example-preformatted"> <div class="highlight" style="background: #f8f8f8"> <pre style="line-height: 125%;"> <span></span>( <span style="color: #800">%i</span> <span style="color: #666">1</span>) <span style="color: #BBB"> </span> |

But when I pass the same bit of maxima example code to pygments using |pygmentize -l maxima -f html|, I get

|<div class="highlight"> <pre> <span></span> <span class="p">(</span> <span class="no">%i</span> <span class="mi">1</span> <span class="p">) |

So the html from texinfo seems to have stripped out the classes used in the span elements.

Or maybe texinfo run pygmentize with extra options?

Anyway, since texinfo doesn't allow telling pygments what style to use, I was thinking of solving this by updating the CSS with the pgyments style that I want. This would also allow setting appropriate colors for dark mode.

&#8203;

Reply via email to