Settings
Text format

This project is not covered by Drupal’s security advisory policy.

This module provides a preprocess function on fields. If the field has a filter format that allows for code blocks and if the field has any of them in its value it will automatically add the required highlightjs libraries from the CDN. Simply install this module and your code blocks will be highlighted.

Visit /admin/config/system/field-highlightjs to change the module settings.

There you can:

  • change the CSS theme
  • change the library version
  • change the CDN destination
  • enable/disable languages

The module uses the default CDN highlightjs.min.js which supports around 40 common languages. Any languages that you enable that are not included in that list will be added seperately.

There is also an outstanding issue with Ckeditor5 in D9 that does not allow for the codeblock plugin configuration to be changed. After this is fixed this module can have a stable version released:

https://www.drupal.org/project/field_highlightjs/issues/3282233

Project information

Releases