Download & Extend

TinyMCE + GeSHi filter compatibility

Project:TinyMCE
Version:5.x-1.9-1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

Comments

#1

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?

#2

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

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

#3

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 report» support request
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 :)

#4

Status:closed (won't fix)» active

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

#5

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

#6

Category:support request» feature request

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.

#7

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.

#8

#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.

#9

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

#10

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.

#11

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.

#12

It's also worth adding:

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

in the same place too.

Thanks for the tip :-)

#13

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

#14

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?

nobody click here