Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting ‘specificity’ lower compared to text editors #6088

lifepeer opened this issue Jul 14, 2019 · 2 comments


Copy link

commented Jul 14, 2019

I'm using the built-in Chroma syntax highlighter but it seems to lack specificity compared to let's say VSCode or Atom. Consider the following example in JavaScript:


As you can see, the output from Hugo/Chroma is limited in terms of how many different ‘elements’ it recognises.

This is confirmed by using the option pygmentsUseClasses=true and inspecting the classes it assigns to elements which are highlighted using different colours in text editors but the same once processed by Hugo/Chroma, for example ‘target’ and ‘offset’ both share the class="nx" even though one is a parameter and the other is a method. Another example is ‘this’ and ‘return’ which are both class="k".

This issue is even more striking if you use some other language like R, which looks like there's no syntax highlighting at all… :(


Is it possible to set up Hugo/Chroma to differentiate between such elements and assign them different classes, please?

@lifepeer lifepeer changed the title Syntax highlighting ‘specificity’ much lower compared to text editors Syntax highlighting ‘specificity’ lower compared to text editors Jul 14, 2019


This comment has been minimized.

Copy link

commented Jul 15, 2019

To get a fix for this, you need to open up an issue in the Chroma issue tracker:

@bep bep added the Upstream label Jul 15, 2019


This comment has been minimized.

Copy link

commented Jul 15, 2019

Roger that, thank you.

In case someone comes across this and wants to follow the issue over at alecthomas/chroma.

@bep bep closed this in 95b1d30 Jul 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.