This module enables the CodeSnippet plugin from CKEditor.com in your WYSIWYG. It includes the highlightjs library and all available styles for it. If you've ever wanted to drop code examples in your Drupal content and have it highlighted in a pretty format, this is for you.
WYSIWYG (dev version), Libraries API, and CKEditor library version 4.x+ are required.
Download the CodeSnippet plugin from ckeditor.com, and place it in your ckeditor/plugins/codesnippet directory. Enable the button on any of the CKEditor enabled WYSIWYG profiles, and configure the stylesheet you want under 'CodeSnippet Settings'.
The button will be available on your CKEditor - simply click, paste your code, select the language, and you're all set.
On the WYSIWYG profile page, you can select from one of the many included stylesheets in highlightjs. It is already packaged with the plugin from ckeditor, so select a flavor and run with it!
Why not just use CKEditor module?
This is for the folks who went the WYSIWYG route, as it is more flexible and (seemingly) integrates better with things like the Media module and all of its related modules. WYSIWYG currently doesn't fully support CKEditor 4.x (hence needing to use the dev version of that module) so adding extra native plugins like this is a little hairy. I wanted it to be dead simple for site builders to go in and turn it on and not worry about configuring JS settings or anything like that.
Drupal 8 Version
There are no plans for a Drupal 8 version of this module. A simpler module built for Drupal 8 core can be found here.
- Maintenance status: Actively maintained
- Development status: Maintenance fixes only
- Module categories: Content, Content Display, Utility
- Reported installs: 86 sites currently report using this module. View usage statistics.
- Downloads: 1,535
- Last modified: November 4, 2015
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.