Skip to content

common/highlightjs: Use dynamically generated languages data

Instead of hardcoding the set of supported programming languages and their aliases in the common.highlightjs module, read those data from a JSON file instead.

That JSON file is generated during frontend assets processing by webpack by using the highlightjs library API. This ensures languages data will always be in sync with current release of the highlightjs library.

The produced JSON file is stored in git as it is needed to execute backend tests. Its content might change each time a new release of highlightjs is available.

Test Plan

I have updated Python tests to match latest highlightjs release and ensured the cypress tests related to languages highlighting I put in place some times ago still pass (can be executed by invoking make test-frontend-full).


Migrated from D4551 (view on Phabricator)

Merge request reports