Syntax Highlighting

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?

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?

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

Hi, I have the same problem. These are the configuration params of my weblog:
$ hugo env
Hugo Static Site Generator v0.31.1 linux/386 BuildDate: 2017-11-27T14:56:27+03:30
GOOS=“linux”
GOARCH=“386”
GOVERSION=“go1.9.2”

$ hugo config | grep pygments
pygmentscodefences = true
pygmentscodefencesguesssyntax = true
pygmentsoptions = “”
pygmentsstyle = “monokai”
pygmentsuseclasses = false
pygmentsuseclassic = false

It is part of a markdown file with some Octave/Matlab code:

```matlab
function cspdemo

Up = [-0.93000   0.34000; 0.34000   0.93000];
Lp = [0.250000   0.00000; 0.00000   2.50000];
Um = [-1, 1; 1 1];
Lm = [0.25000   0.00000; 0.00000   1.50000];

and this is what hugo generates:

<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-matlab" data-lang="matlab">function cspdemo
Up = [-0.93000   0.34000; 0.34000   0.93000];
Lp = [0.250000   0.00000; 0.00000   2.50000];
Um = [-1, 1; 1 1];
Lm = [0.25000   0.00000; 0.00000   1.50000];

even when I set pygmentsUseClasses = true in config.toml, the result is the same.