Syntax Highlighting


#1

Hi,

I’ve been trying without success to get the Chroma Syntax Highlighting to work. I’ve generated the css file correctly, and set same properly in my headers – I get the correct background color, code color and font. My config has CodeFences set to true, and pygmentsUseClasses is also set to true.

When I inspect the generated code, however, there is no Chroma code at al in what is generated apart from the initial <pre class=“chroma”>

I’ve tried it now with HTML, PHP and Python, and in every case, the result is the same: No Chroma classes added to any of the code.

Is there some additional step not noted in the Documentation?


#2

It’s hard with no code exemple to guess the problem but do you specify the language when using CodeFences and if not do you have pygmentsCodefencesGuessSyntax = true in your config?


#3

You mean pygmentsCodeFences - yes?

You did not set (?):
pygmentsUseClassic = true
as this would fallback to Pygments

I use this config:

pygmentsUseClassic            = false
pygmentsCodeFences            = true
pygmentsCodeFencesGuessSyntax = true
pygmentsUseClasses            = true

What’s the output of:
hugo env

and (if your OS has a grep command)
hugo config | grep pygments