How does Hugo highlight code?

I’ve spotted a bug I want to fix - Hugo doesn’t correctly recognise classes that are not predefined.

Sublimetext:
image
Hugo output (dracula style):
image
Hugo output (monokai style):
image

Here’s my code if anyone wants to investigate:

type NewType float32

var NewTypeArray = [2][2]NewType{}
var FloatArray   = [2][2]float32{}

const (
	NewTypeConst NewType = 1 
	NewTypeConst float32 = 1 
)

var NewTypeVar NewType
var FloatVar float32

I’m not sure how to go about fixing this because I’m not sure where the problem lies within Hugo.

Any help would be appreciated!

Did you try another chroma style?

https://xyproto.github.io/splash/docs/all.html

1 Like

Good question @nfriedli, I’ve conducted more detailed analysis and updated the main post

We use https://github.com/alecthomas/chroma/

Thanks I’ll see if I can raise an issue there

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.