I have tinymce installed, i m wondering if theres a way we can get geshi hightlighter to work with tinymce

Comments

soxofaan’s picture

Component: Code » User interface

I'm not familiar with tinymce, I will have to look into this.

What do you actually mean with "work with"?
Are there currently any conflicts or something?
Or do you want real time syntax highlighting in the tinymce text field?

sibidiba’s picture

Version: 5.x-2.8 » 6.x-1.1
Category: support » bug

it is impossible to enter source code into the editor, because all special characters includeing < and > in the beginning tag get translated by the editor

soxofaan’s picture

Title: can we make geshi work with tinymce » TinyMCE + GeSHi filter compatibility
Project: GeSHi Filter for syntax highlighting » TinyMCE
Version: 6.x-1.1 » 5.x-1.9-1
Category: bug » support
Status: Active » Closed (won't fix)

I just tried TinyMCE a bit and it indeed changes the special characters like "<" and ">" to "&lt;" and "&gt;".

I don't think this should be fixed/decoded again in GeSHi filter, doing so seems like opening can of worms to me (considering all the other options of WYSIWYG and non-WYSIWYG input modes around).
For example: since the TinyMCE editor can be made optional, you never know if a "&lt;" in the GeSHi filter input was intended as "&lt;" or as "<" by the writer.

This issue should be fixed in the TinyMCE editor itself, maybe as a sort of plugin or something, but I'm not familiar enough with TinyMCE to provide more insights :)

soxofaan’s picture

Status: Closed (won't fix) » Active

(sorry, the "won't fix" was not necessary)

elk-x’s picture

Any news or tutorials on this topic? Would love to get Code input working with a WYSIWYG editor

eagereyes’s picture

Category: support » feature

I have the same problem. I just spent almost an hour looking for a tinymce plugin that uses GeShi or something similar. Most projects are dead or only seem to exist as rumors. One works, but inserts a textarea and doesn't seem to produce any highlighting for python.

So here is a suggestion: I know you're not interested in writing a tinyMCE plugin (though it would be great to do that using Ajax and GeShi, rather than the hacked-together solution I linked to above). But what about making geshi-node into a CCK field that can be added easily to any node? That would solve the GUI editor problem (at least largely), and would be more useful and flexible than geshi-node.

eagereyes’s picture

Actually, what I describe above can be done to an extent by adding a nodereference field to your favorite content type and then selecting "full node" for display of that field in full node display. This essentially attaches the entire node, including title, submitted-by, etc. It's not too bad, but a proper field would certainly be a better solution.

soxofaan’s picture

#6: There is a patch for a GeSHi CCK field here: #179097: Geshi Source Code CCK Field
I'd like it to have more testers before committing it, so be welcome to try it out.

eagereyes’s picture

Great, thanks for the pointer! Though it doesn't seem to be compatible with 6.6 (see my note in the other thread).

jakephot’s picture

Hi. I finally found a simple way to deal with the < and > problem.
Just add a few lines into geshi.php at around line 2016.

// Replace all newlines to a common form.
$code = str_replace("\r\n", "\n", $this->source);
$code = str_replace("\r", "\n", $code);

after this, add the following (take out the space between & and gt, lt

$code = str_replace("& gt;", ">", $code);
$code = str_replace("& lt;", "<", $code);

I'm using Drupal 6 and it worked as I intended.

Bobby1290’s picture

Thanks!

Another option using drupal 6 is the one I use;

- set the wysiwyg profile->cleanup and output to ONLY "Convert <font> tags to styles"

- use the brackets instead of the < / > signs for the geshi filter.
(ie. [code] instead of <code> )

I can just add the code to a tiny controlled area by using the html button.

And the formatting persists when saving multiple times.

richardathome’s picture

It's also worth adding:

$code = str_replace("& amp;", "&", $code);

in the same place too.

Thanks for the tip :-)

tlarkin’s picture

Thread resurrection...

How do I go about fixing this like in post #10? I tried editing the PHP file but it screwed everything up...

thanks

tlarkin’s picture

I am still trying to get this to work with my WYSIWYG editor TinyMCE and every time I post a shell script with any sort of < or > in it, it doesn't display properly. Tried numerous fixes, any other ideas?

pomliane’s picture

Status: Active » Closed (won't fix)

This version of TinyMCE is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.