There are many CKEditor plugins available which provide special functionality - mostly new buttons - for your editor. One is CodeSnippet, which adds a simple way to add formatted code snippets to your textfields.
To add the plugin to your editor you need to do 3 things:
- Download a CKEditor build which includes the plugin and its dependencies.
- Implement hook_wysiwyg_plugin to make the plugin visible to Drupal and the Wysiwyg module.
- Add the button to your Wysiwyg profile.
Implement hook_wysiwyg_plugin
function MY_MODULE_wysiwyg_plugin($editor, $version) {
$path = wysiwyg_get_path('ckeditor');
switch ($editor) {
case 'ckeditor':
return array(
'codesnippet' => array(
'path' => $path . '/plugins/codesnippet',
'buttons' => array('CodeSnippet' => t('CodeSnippet')),
'url' => 'http://ckeditor.com/addon/codesnippet',
'load' => TRUE,
),
);
break;
}
}
Bonus: Use highlight.js for syntax highlighing
This one is easy, simply install the highlight_js module.