Hello
Is there a tutorial how to integrate this great module with Geshi Filter for syntax highlighting

there are serveral issues like
http://drupal.org/node/283444 & http://drupal.org/node/269937

I want to be able to mark part of the text as code and set it's code language

I will be happy to document this if someone can give me a hint

Comments

wwalc’s picture

Actually I think that the best solution would be to create a simple plugin that integrates Geshi Filter with FCKeditor.
At this moment all you have to do is to switch to source mode, create a <pre> tag with a "type" attribute (pre should be added to "Generic syntax highlighting tags" in Geshi Filter settings).

The plugin I'm thinking of could contain the following things:
- textarea for a code
- select box with all languages supported by Geshi
After user presses the "ok" button, code could be automatically surrounded by <pre type="php"> and pasted into FCKeditor.

Additionally, you could use the "Style" button in FCKeditor and add in fckstyles.xml

	<Style name="Code: PHP" element="pre">
		<Attribute name="type" value="php" />
	</Style>
	<Style name="Code: Java" element="pre">
		<Attribute name="type" value="java" />
	</Style>

this way after code is already in FCKeditor you could still easily change it's language using the "Style" button.

Useful links:
http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API
http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Customization/P...

Remember to share your plugin with others if you create such ;-) I could add it to the FCKeditor module.

WorldFallz’s picture

Just an FYI-- I just found this, thought it might be worth a look:

Geshi Filter for FCKeditor: GeSHi Pro.

I'll post back after I give a try.

Grayside’s picture

This looks pretty good. However, it works by applying the code-highlighting at the time you compose your post. It is stored as HTML.

That really locks you in to GeshiPro, FCKeditor, and the specific styles applied to the code at the time you compose it.

nicorac’s picture

This works well, except for special HTML chars like ">".
Suppose you're writing some PHP code like this:

$a = array('key1' => 'value1');

If you swap from WYSIWYG to source view and back, all of your ">" will be replaced by "%gt;"

How to solve this?

JBravo’s picture

wwalc
Thanks, man. That is just what I need.

Jorrit’s picture

Component: Code » Compatibility with other modules
Status: Active » Closed (fixed)

It seems to be solved.