Syntax highlighting support for additional languages

Hey all,

First, I want to say thanks to everyone who helps to maintain and support Discourse, it’s really fantastic software and I’ve enjoyed using it!

Also, sorry in advance for the formatting with links, I’m not allowed to post more than 2 as a new user.

I’m writing because I wanted to get some clarification on the best way to add syntax highlighting support for a language that Discourse doesn’t currently support. To my knowledge, this was the last thread about the topic, and there was also some discussion about it here. When I’m reading these threads, it looks to me like the provided solutions are kinda meant to be temporary, and it’s unclear if they’ll be supported going forward. And my impression from what Sam Saffron said in this comment on GitHub [1] is that if Discourse could find an easy way to pull in all the languages that highlightjs already supports, but that aren’t in the monorepo at [2], then they would do that.

To me, it would be ideal if Discourse could bundle, or at least consider bundling, more of the repos at [3] . From what I understand, the main repo itself is closed to new additions, so when Discourse only includes that, they are effectively grandparenting in the 180-some languages that were in this main repo before the policy change, while asking for more effort for newer languages. At the same time, I understand development time and resources are finite, and don’t want to make an unreasonable demand.

At the very least, I’d appreciate if someone could say with some degree of certainty what the right way to do this is, and whether there’s any interest in including support for more languages into the main Discourse product going forward. I think this is also an appropriate time to ask, as it seems the maintainer of highlightjs is currently making an effort to make it easier for these separate language repos to get integrated – see [4]. An answer to this question would hopefully clarify things for me and anyone else who wants to add syntax highlighting to their Discourse instance.

Thanks for your time! ^^

[1] github. com/highlightjs/highlight.js/pull/2051#issuecomment-500715239
[2] github. com/highlightjs/highlight.js
[3] github. com/highlightjs
[4] github. com/highlightjs/highlight.js/issues/3008

Oof, probably should read a little more before typing so much text! Is the right thing to do just this comment with the extra instructions farther down the page? I haven’t tried it yet, but this looks promising.

2 Likes

Yes, that should be the answer. Did you get it to work?