1

I am going to rewrite a project that currently uses Pygments in Crystal. I need a replacement for Pygments. It doesn't have to be a library, it can be a standalone binary I call out to.

I found GNU source-highlight, which I thought for a while would do but it seems to only support color attributes and not class attributes, which prevents me from using a runtime stylesheet (I have a dark mode switch that changes the background color of code blocks, which must also change the code colors to keep them readable).

I'm not okay with using a Javascript-based solution. This must work with Javascript disabled.

Ideally the set of CSS classes it outputs is simpler than Pygments; I'd rather have a simpler stylesheet than be able to color a bunch of different categories of keywords differently. I do need to be able to define classes that go for all languages with generic categories like "keyword", "type", "literal", rather than a different scheme for each language (it's not that I want them to be the same, just that I don't want my code to be concerned with every language the highlighter supports). I do not need the ability to add my own languages, only that all common languages (ie. top 20 or so) are supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.