Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Please support the GeSHi Filter for syntax highlighting module.
http://peterpetrik.com/blog/ckeditor-and-geshi-filter gives an example of how to do it but with CKeditor, but it uses the CKeditor module.
Comments
Comment #1
TwoDWysiwyg module provides a way to tell editors about native plugins via hook_wysiwyg_plugin and since the solution you linked to is implemented as such, this should be no problem. You'd basically follow the same steps as for ckeditor.module, but there is no need to modify the original CKEditor files (ckeditor.config.js). Instead you implement hook_wysiwyg_plugin and provide the information the editor needs there. It makes updating Wysiwyg, CKEditor, and the plugin a lot easier since they are kept separate.
For now, we only include plugins which are needed for compatibility with Drupal Core functionality in Wysiwyg module, so this is a "won't fix".
There is more info about implementing the hook in wysiwyg.api.php (Wysiwyg 6.x-2.x-dev version of the file is most up to date.)
Here's how to implement the hook:
Create sites/all/modules/wysiwyg_geshi/ and put a wysiwyg_geshi.info file in it, same as for all other Drupal modules.
Then create wysiwyg_geshi.module:
Create sites/all/modules/wysiwyg_geshi/ckeditor and place the plugin.js file from the blog post in it.
Enable the wysiwyg_geshi module in your Drupal installation, then enable the Geshi buttons you need in admin/settings/wysiwyg/ for each editor profile.
Remember that you still need the geshifilter.module and the Geshi library. Wysiwyg module will not run any code when the rendered node is Viewed, the Geshi Filter module takes care of that part, and the Geshi library is of course the actual highlighting code it uses.
You will also need to add the CSS from the post (under "Toolbar button theme") to your theme's stylesheets and make the necessary modifications to geshifilter.module (under "GeSHi configuration"). It might actually be a good idea to file a feature request to geshifilter.module about adding that php code as an optional filter setting, then you'd not have to modify either module anymore.
Comment #2
Aren Cambre CreditAttribution: Aren Cambre commentedThanks for the detailed rundown. Moving to new project.
Comment #3
Aren Cambre CreditAttribution: Aren Cambre commentedComment #4
Aren Cambre CreditAttribution: Aren Cambre commented[comment deleted]