Raku, Go, Chroma, Germanium, Hugo and my blog
When I created my Raku programming language website with
Hugo static site generator, I had to manually create the syntax highlighted
html files for code examples shown in the front page, because Hugo used
Chroma(written in Go and uses a
mostly similar API to Pygments) for syntax highlighting which didn't
support Raku. So I opened an issue on Chroma, the discussion showed that you cannot just convert
the Raku lexer from Pygments to Chroma; You would need to create some functions manually, and
Chroma needed a new Emitter
interface which would take the LexerState
as an argument, because
Raku has some complex syntax; the Raku lexer in Pygments had functions for finding closing
brackets matching the opening brackets, and for regex nesting in tokens
, regexes
and
rules
. In the end I realized functions for token nesting were unnecessary.