Highlight.js Syntax Highlighter
A simple Highlight.js-based syntax highlighter plugin for WordPress.
by Thorsten Frommen · github.com/tfrommen/highlightjs · website
★ 3stars
2.5kcomposer installs
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/tfrommen/highlightjs/archive/refs/heads/main.zipAlso on Packagist as tfrommen/highlightjs:
composer require tfrommen/highlightjsFrom the readme
Highlight.js Syntax Highlighter
A simple Highlight.js-based syntax highlighter plugin for WordPress.
Installation
Install with Composer:
Or:
1. Download ZIP.
1. Upload contents to the /wp-content/plugins/ directory on your web server.
1. Activate the plugin through the Plugins menu in WordPress.
1. See syntax highlighting for all code snippets wrapped in tags (e.g., a core/code block).
Requirements
This plugin requires PHP 7.4 or higher.
Usage
Please refer to the Highlight.js documentation.
Filters
In order to customize certain aspects of the plugin, it provides you with several filters.
For each of these, a short description as well as a code example on how to alter the default behavior is given below.
Just put the according code snippet in your theme's functions.php file or your customization plugin, or to some other appropriate place.
\tfrommen\HighlightJs\FILTERSHOULDLOAD (highlightjs.shouldload)
This filter lets you customize the condition for the plugin to load.
The default value is the result of issingular( 'post' ) && hasblock( 'code' ), meaning the plugin only loads for single posts that include at least one core/code block.
If you want to load the plugin f
Read the full README on GitHub →
Releases
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.