Anybody? Is it a bug? How to fix it today? I can’t make it work correctly.
It’s hard to tell from the bug report what’s causing this. But there are two possible scenarios:
- Chroma (which Hugo uses for syntax highlight) recognises the different tokens, but the CSS is not applied properly.
- For instance, keywords and literal strings are given the same colour. Which makes it looks like ‘it doesn’t work properly’.
- Chroma doesn’t recognise particular tokens in the syntax.
Can you show the Hugo-rendered HTML for the languages you have a trouble with? That way we can determine if it’s point one or two from above.
It also helps if you can tell what’s wrong. The screenshots on GitHub help, but I do not see ‘huge differences’ or something that’s ‘really bad’. I count four differences:
pmap. But I of course don’t know how your language should look in the first place.
I updated issue on github about HTML generated by Hugo. It looks like HTML it wrong generated.
but I do not see ‘huge differences’
For example the first word in
() is always a function which is called. It should be different colour.
defn are language functions. Values like 0 should be in different colours. Keywords like
Generally if it will be done like in http://pygments.org/ it will be good enough.
This is the code from my blog, which I am trying to move to Hugo:
It is hard to describe how it should be highlighted. You will have to understand Clojure syntax to understand it probably At least I am not sure how to describe it to you easy. But the point is it works with https://highlightjs.org/ and http://pygments.org/ but not with Hugo.
I am generating it in md file by:
(def counter (atom 0))
(def foo (atom 1))
(defn slow-inc [n]
(swap! counter inc)
(swap! foo slow-inc))
Thanks for the added information!
The problem isn’t with Hugo but with Chroma. Some of the keywords – if that’s how they’re called in Clojure – are not in Chroma’s lexer at this time. So it isn’t a bug or error, but more like a missing feature.
I see you already opened an issue in the Chroma repository.
Once it gets fixed in Chroma, with the next release of Chroma the fixes also come in the subsequent release of Hugo.
I updated an issue. It looks like in Chroma it works.
Any idea why it doesn’t work? I still suffer this issue.