In condition to issue #1293476: How to combine GeSHi Filter with Wysiwig module (TinyMCE editor) ?.
We can manually tune GeSHi Filter for use with wysiwyg editors:
1. Only one tag is allowed for filter - <pre>
2. Turn off any html validation in wysiwyg editors setting.
3. Insert your code in editor textarea as <pre> tag in form <pre start="1" linenumbers="normal" type="my language" title="My title"> or use http://drupal.org/sandbox/victor_gamedev.by/1270766 module.
4. Edit geshifilter.pages.inc file. In function geshifilter_geshi_process() add after
// remove leading/trailing newlines
$source_code = trim($source_code, "\n\r");
this lines
// fix: Replace any HTML specials
$source_code = str_replace(">", ">", $source_code);
$source_code = str_replace("<", "<", $source_code);
$source_code = str_replace("‹", "‹", $source_code);
$source_code = str_replace("›", "›", $source_code);
$source_code = str_replace("'", "'", $source_code);
$source_code = str_replace(""", "\"", $source_code);
$source_code = str_replace("&", "&", $source_code);
that's all.
Comments
Comment #0.0
W32 commentedcorrect bug in text
Comment #1
lliss commentedThis patch provides a fix for problems caused by conflicting format correction when using geshi filter module and a wysiwyg style editor such as TinyMCE or CKEditor.
So I don't particularly like this fix long term but if you (like me) need geshi filter to work with WYSIWYG style editors and you don't particularly care if it works without them, then this patch is probably fine. I haven't tested it without the editor but it solves the problem when using TinyMCE which is currently good enough for my purposes and may be for others as well.
Comment #1.0
lliss commentedagain correction
Comment #2
yukare commentedBecause of #2047021: Special chars are html entities in highlighted code this is not necessary anymore.