Download the PHP package tfrommen/highlightjs without Composer
On this page you can find all versions of the php package tfrommen/highlightjs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tfrommen/highlightjs
More information about tfrommen/highlightjs
Files in tfrommen/highlightjs
Package highlightjs
Short Description A simple Highlight.js-based syntax highlighter plugin for WordPress.
License MIT
Homepage https://github.com/tfrommen/highlightjs
Informations about the package highlightjs
Highlight.js Syntax Highlighter
A simple Highlight.js-based syntax highlighter plugin for WordPress.
Installation
Install with Composer:
Or:
- Download ZIP.
- Upload contents to the
/wp-content/plugins/directory on your web server. - Activate the plugin through the Plugins menu in WordPress.
- See syntax highlighting for all code snippets wrapped in
<pre><code>tags (e.g., acore/codeblock).
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\FILTER_SHOULD_LOAD (highlightjs.should_load)
This filter lets you customize the condition for the plugin to load.
The default value is the result of is_singular( 'post' ) && has_block( 'code' ), meaning the plugin only loads for single posts that include at least one core/code block.
If you want to load the plugin for all single posts, no matter what blocks are included in the content:
If you want to load the plugin for all requests, you can use the __return_true WordPress function:
License
Copyright (c) 2017 Thorsten Frommen
This code is licensed under the MIT License.
The included Highlight.js is released under the BSD License.