Can't get the Pygments to use classes [solved]

Hi all,

I’m having trouble to switch Pygments from inline styles to classes.
Here’s my troubleshooting process. I really set the pygmentsUseClasses to true in config.toml:

pygmentsUseClasses: true

I did try adding and removing additional pygmentsStyle variable, I tried both mentioned pygments variables in small caps. I tried restarting server numerous times after each change. I tried switching my config.toml to config.yaml (maybe the format was wrong; it was not). I also tried getting a new config.toml file, and adding pygmentsUseClasses onto it. No, it’s not the config file.

I can’t find the issue – my website is showing Monokai code colouring, all in-line CSS, no matter how I try to set the pygmentsUseClasses.

Am I missing something? Maybe I’m meant to customise the Pygments directly through bash or some setup files where it was installed?

Also, if somebody could confirm, does Hugo Pygments classes setting work at all?


Works fine with me.

Note that for TOML, the syntax is:

pygmentsUseClasses = true

Other than that, I would check the Pygments version. Mine:

pygmentize -V   
Pygments version 1.6, (c) 2006-2013 by Georg Brandl.

Thank you Bjornerik!

I just found the issue. I had everything set right, just the example in documentation,

{{< highlight html >}}
<section id="main">

is not correct – the html is not a valid parameter for latest Pygments (at least 2.0.2 if not all versions).

I tried {{< highlight xml >}}, {{< highlight css >}} and so on and all are fine. I can’t find the spec for Hugo highlight function lexer attributes, but is good hint. That’s weird that html is not working…