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

Closed
lifepeer opened this issue Jul 14, 2019 · 3 comments
Closed

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

lifepeer opened this issue Jul 14, 2019 · 3 comments

Comments

@lifepeer
Copy link

lifepeer 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:

ggdf

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… :(

hfgdh

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
@bep
Copy link
Member

bep commented Jul 15, 2019

To get a fix for this, you need to open up an issue in the Chroma issue tracker: https://github.com/alecthomas/chroma/issues

@bep bep added the Upstream label Jul 15, 2019
@lifepeer
Copy link
Author

lifepeer 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 as completed in 95b1d30 Jul 16, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants