How to get Solidity syntax highlighting

I am using a hosted Discourse service and wanted to know how to get Solidity syntax highlighting working.

Solidity isn’t a language in GitHub - highlightjs/highlight.js: Javascript syntax highlighter but there is a repo for the Solidity language GitHub - highlightjs/highlightjs-solidity.

Best approach is to submit a PR to highlightjs to add it, that way we will get it next time we upgrade highlightjs

3 Likes

What is the frequency of that?

We pretty much update every release, if you get it into highlight we will update.

3 Likes

Hi @sam
I have been advised that Solidity should stay in it’s own repo (GitHub - highlightjs/highlightjs-solidity) rather than be added to the highlight.js repo.

How do I configure a hosted discourse forum to use this repo?

I added a comment there, will follow up next week here depending on the response we get.

Perhaps create your own repo with the language, to start? We can then add it to the list of highlight languages we pull?

2 Likes

Hi @sam

A repo with the Solidity language is in the highlightjs organisation already:

2 Likes