Pygments style is ignored

I’m using the Hugo Cactus Theme from digitalcraftsman, but that theme uses highlight.js and I want to use Pygments to do server-side highlighting. I have the following lines in my config.toml:

pygmentsCodeFences = true
pygmentsUseClasses = true
pygmentsStyle = friendly

The issue is that the code is always rendered with what I think is the monokai theme (changing pygmentsStyle has no effect). Here is some example text that is not being highlighted properly:

class someClass(object):
    def __init__(self):
        self.x = 1

I’ve downloaded the entire repo of CSS styles and tried putting them in static/css/ and themes/hugo-cactus-theme/static/css/, but neither worked. I’ve also tried commenting out the lines that run highlight.js to eliminate the possibility of two different highlighting styles writing over each other, but that hasn’t worked either. I’m running Hugo v0.19 and Pygments v2.2.0, so I believe I’m on the latest version. What else should I try?

Can you point me to the repo?

And just to be sure, have you turned JS off in your browser and then run the site locally just to make sure that highlight.js isn’t being run?

I just tried it with JS disabled, and I got the same behavior. Here is the link to the hugo-cactus-theme.

I meant to your project :smile:

Sorry :slightly_smiling: Here’s the link to my repo. You’ll see a handful of recent commits because I had it as a private repo, and was waiting to make some commits until I had this sorted out. I’ve made it public now, so everything should be in order.

Forgot to mention, the post with the code in it is

Any progress? I still haven’t gotten it to work yet.

Did you ever resolve this ?

It wasn’t working for me either until I quoted the style “friendly” but even though you don’t have it quoted here I see you have it quoted on your repo.

Although, Pygments is misspelled on two of the lines:
PygmentsCodeFences = true
PygmentesUseClasses = false
PygmentesStyle = “friendly”

Thank you @nyarlathotep this thread slipped my mind. Didn’t mean to leave you hanging @zmitchell. Cheers.

God damnit, that fixed it :joy:

1 Like