The CC-Syntax-Highlight plugin supports syntax highlighting of Posts, Pages, and any public Custom Post Types.
It uses highlight.js or google-code-prettify libraries.
Additionally it can use the clipboard.js library to add a button that copies text to the clipboard and highlightjs-line-numbers.js plugin to add line numbers.
It is delivered with support for shortcode (default [code] – you can change it on the settings page) which automatically converts all special characters to HTML entities.
This plugin is compatible with Multisite WordPress installations.
How does it work?
- Go to the ‘Settings > Syntax Highlight’ page, select your preferred options and save them.
- Simply add the source code to your post (or other selected public Custom Post Type) wrapped with:
<pre><code>Your source code</code></pre>
or if you would like to automatically convert all special characters to HTML entities, use shortcode wrapper instead (default [code] – you can change it on the settings page):
<pre>[code]Your source code[/code]</pre>
Plugin’s js scripts and css styles files only load if the source code occurs on displaying page.
From your WordPress Dashboard
- Go to ‘Plugins > Add New’
- Search for ‘CC-Syntax-Highlight’
- Activate the plugin from the Plugin section on your WordPress Dashboard.
- Download ‘CC-Syntax-Highlight’.
- Upload the ‘cc-syntax-highlight’ directory to your ‘/wp-content/plugins/’ directory using your favorite method (ftp, sftp, scp, etc…)
- Activate the plugin from the Plugin section in your WordPress Dashboard.
- Visit the ‘Settings > Syntax Highlight’ page, select your preferred options and save them.
The plugin can be activated and used for just about any use case.
- Activate at the site level to load the plugin on that site only.
- Activate at the network level for full integration with all sites in your network (this is the most common type of multisite installation).
Contributors & Developers
“CC-Syntax-Highlight” is open source software. The following people have contributed to this plugin.Contributors
Translate “CC-Syntax-Highlight” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Release date: 16.03.2022
- Added PHP 8.0 support.
Release date: 22.10.2019
- Fixed conflict with core clipboard wp script.
Release date: 15.10.2019
- Added highlightjs-line-numbers.js plugin in 2.7.0 version.
- Updated highlight.js script to 9.15.10 version.
Release date: 15.06.2018
- Fixed issue with wrong brackets interpretation.
Release date: 05.12.2016
- Added support for “copy-to-clipboard” feature by using the clipboard.js library.
Release date: 01.10.2016
- Corrected readme.txt file.
Release date: 27.09.2016
- First stable version of the plugin.