Codeblocks Extended with PrismJS

plugin banner

Codebocks Extended with PrismJS includes syntax highlighting, copy to clipboard, and Visual + Text editor integration.

Author:duplaja (Dan D.) (profile at wordpress.org)
WordPress version required:3.0.1
WordPress version tested:5.2.20
Plugin version:1.1
Added to WordPress repository:23-10-2016
Last updated:05-06-2019
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:https://dandulaney.com
Total downloads:1 217
Active installs:10+
plugin download
Click to start download

Codeblocks Extended with PrismJS was born of a personal need for a lightweight code highlighter, with special functionality.
Many of the other PrismJS based plugins in the repository were either outdated, or were lacking features that I was looking for.

Features:

  • Integrates the latest PrismJS build, with the most common langauges used.
  • Integrates the PrismJS line-numbers plugin, to automatically number lines of code.
  • Integrates the PrismJS line-highlight plugin to allow you to highlight specific lines of code.
  • Integrates ClipboardJS + custom jQuery to add a “Copy to Clipboard” button to each code block.
  • Custom Text Editor button to wrap selected text with the most commmon <pre> and <code> classes, and replacing special characters with their HTML safe equivalents.
  • Custom Visual Editor / TinyMCE dropdown button, with the most common languages to wrap selected text.
  • Since this works via wrapping <pre> and <code> tags with classes, you can use all custom class settings that PrismJS offers.
  • No shortcodes to mess with, so you don’t have to worry about losing whitespace between editor modes.
  • No settings page needed: Just activate it and go!

For a full list of languages supported and more information on this plugin’s use, please check out the FAQ.

Note: This does NOT auto-detect the language. Most plugins that do so brute force the languages or require file extensions, resulting in a much heavier plugin. The decision was made to keep this as light-weight as possible.

Note 2: This is designed to work with the Classic Editor. It does not currently work in Gutenberg blocks.

Thanks to Mike @ WP Bullet for the banner and icon.


Screenshots
FAQ
ChangeLog