Loads highlight.js and clipboard.js on single pages in WordPress for syntax highlighting with a 1-click copy to clipboard button.
From 768px and below, it will always appear.
Included Theme:
- GitHub Dark Dimmed
Included Languages:
- HTML, XML
- CSS
- PHP
- JavaScript
- JSON
- Markdown
- Plain text
- SCSS
-
Click on the
Download ZIP
button at the right to download the plugin. -
Upload the entire
wp-highlightjs
folder to the/wp-content/plugins/
directory. -
Activate the plugin through the
Plugins
menu in WordPress.
In WordPress' Gutenberg editor, type / to begin typing code
and hit return when you see a match.
Paste your code.
If using Oxygen, wrap your code in a code
element and that in a pre
element having a class of wp-block-code
.
Ensure that there are no spaces between the HTML tags.
- Made the script to load on all singular pages, not just posts.
- Fixed JS error with the forEach loop in the initilization script.
- Updated highlight.js and clipboard.js libraries to their latest versions.
- Removed the call to Google for the Source Code Pro font. It is now included in the plugin.
- Replaced the syntax highlighting theme with "GitHub Dark Dimmed".
- Replaced
wp_localize_script()
withwp_add_inline_script()
for passing the copy icon's URL from PHP to JS.
- Updated deprecated HLJS Function. Thanks to Taylor.
- Updated highlight.js and clipboard.js libraries to their latest versions.
- Removed "word-wrap: break-word" block for body element in CSS.
- Set the plugin to load only on singular posts and not all singular pages.
- Updated highlight.js and clipboard.js libraries to their latest versions.
- Misc. CSS fixes.
- Updated highlight.js and clipboard.js libraries to their latest versions.
- Updated init js file to fix errors in the console.
- Plugin name is not hardcoded any more in the init js file.
- Replaced Github color theme with Gruvbox Dark.
- Initial Release
Tested up to: 5.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://www.paypal.me/sridharkatakam