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
- Project categories: Site structure, Content editing experience, Integrations
5 sites report using this module
- Created by alexverb on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
Development version: 1.0.x-dev updated 1 Jul 2022 at 20:50 UTC


