Skip to content

Add support for highlighting sub-languages

Currently when viewing a file containing a sub-language (HTML containing CSS for example) only the primary language is highlighted and the sub-language is treated as plain text.

Screenshot_2022-11-14_at_04.33.34

This happens because we only load the core of Highlight.js and then register the primary language that was detected by Rouge. This is done in order to keep the HLJS footprint as small as possible.

We should find a way to load the primary language as well as any other language that was detected.

Possible solution

The frontend relies on the language field which currently only contains the primary language detected by Rouge. We could pass a list of languages detected by Rouge to the frontend instead.