Adding additional languages to highlight.js used by Discourse

(NTAuthority) #1

I read elsewhere on the meta.d boards that Discourse uses a version of highlight.js with only the ‘common’ subset of languages selected.

As this subset does not include Lua, and my Discourse installation frequently has the need of posting Lua snippets, I’m wondering how I would go to add an additional language to highlight.js for my local Discourse installation, without messing with the delete/reinstall routine the Docker manager goes through.

(Kane York) #2

This would be very nice indeed, but there isn’t a way to do it right now. It’s on several people’s wishlists.

(Sam Saffron) #3

There is an open PR with an idea here, but its not finished yet.

(cpradio) #4

For those interested in following the PR

(Sam Saffron) #5

This is now supported, for example, I enabled scss here on meta, cause we use it:

@import "compass/reset";

// variables
$colorGreen: #008000;
$colorGreenDark: darken($colorGreen, 10);

To select the languages you want the highlighted languages site setting.

It was a rather involved change cause we needed to be extra careful everything is cached right and is multisite aware and updateable.

Confused about highlighting in code blocks
(Régis Hanol) #6