2
votes

Does anyone have a confirmed/tested working way of setting up a rich WYSIWYG (like CKEditor or TinyMCE) with support for syntax highlighting (for pasting and sharing java/php/etc.) in Drupal 7.10?

I have now tried a variety of combinations, and I have struggled to get any of them to work in Drupal 7.10. Here is what I have tried:

  1. CKEditor (3.6.2) using CKEditor module (7.x-1.6) with Syntax Highlighter library and Syntax Highlighter Module (7x-1.1). I followed betuts.com/guide-install-syntax-highlighter-ckeditorckeditor-syntax-highlighter-plugin-drupal-7.

    Problem: I could not get a code button into my CKEditor. I just would not appear no matter what I did - perhaps it has something to do with the new drag-and-drop method of adding buttons that has replaced the old text-based one.

  2. CKEditor (3.6.2)with CKEditor module (7.x-1.6) GeSHi Filter (7x-1.0) module and GeSHi libarary following this guide peterpetrik.com/blog/ckeditor-and-geshi-filter.

    Problem: Same as above, I cannot seem to get the code button to appear in my CKEditor.

  3. WYSIWYG module with CKEditor and Google Code Prettifier module + library.

    Problem: Although this solution is simple and works beautifully with no editor, I simply cannot find a good way of getting CKEditor (or any of the other RTEs) to stop HTML-escaping code inside <pre> tags.

I appreciate your help (this is my first post :-)!

2

2 Answers

0
votes

After some more work I got the following combination to work. I also did a more elaborated guide here.

  1. Using WYSIWYG module with CKEditor library. I can insert my code into pre tags (using the Formatted style), and this should also be possible with most other RTEs you can use with the WYSIWYG module.
  2. For the markup itself I installed the Prettify module with the Google Code Prettify library. This will syntax highlight any code within pre or code tags. BUT if you also enable the prettify filter, you will get unwanted html-escapes inside your tags. This is what caused me to think it was CKEditor who did the escapes as described in scenario 3 above.

So this is verified to work with Drupal 7.10, WYSIWYG 7-2.1, and Prettify 7-1.x-dev.

-1
votes

Lars,

We ran into similar issue on our site when posting to our own site and had to modify CKEditor plugin.

Modified plugin code is posted on https://github.com/dbrain/ckeditor-syntaxhighlight/tree/ckeditor-4