Configure which programming languages are available for syntax highlighting

Users can add code blocks to their post with syntax highlighting. See: Select the programming language used in code blocks

The available programming languages are configured in the hightlighted_languages site setting:

You can use this site setting to add additional languages needed by your users, or remove languages that are not needed.

5 Likes

I want to add solidity, a language that is not bundled with highlight.js. It is provided in this package: GitHub - highlightjs/highlightjs-solidity

I’m not sure how to do this. I’ve added it to the discourse settings. Is it going to find the package for me and take care of everything, or do I have to put this extra javascript package somewhere? I’ll appreciate some guidance :slight_smile:

1 Like

I’m also interested in this, to support syntax highlighting of the supercollider language via GitHub - highlightjs/highlightjs-supercollider

1 Like

Bump. If we want to add syntax highlighting support for languages not already in highlight.js, is there any way to add this directly eg via a theme component, or do we need to get the upstream highlight.js people to accept a PR with the additional syntax?

I’m asking as there is an fairly esoteric pair of languages Archetype Description Language (ADL) and Archetype Query Language (AQL) which the owners of discourse.openehr.org would like to be syntax highlight-able. They have technical capability to build a parser/highlighter, they just need to know how to make it work in a Discourse.

3 Likes

It’s totally doable as a theme component! Once you get the HighlightJS script ready ping me here and I can help you build the theme-component .

3 Likes

Thanks @Falco ! I will get the script built and will post back when ready.

3 Likes