English 中文(简体)
Syntax Highlighting in Drupal
原标题:

Which is the best module for Syntax Highligting in Drupal. I am using GeSHi for syntax highlighting my code. It was working fine then I installed a second module FCKeditor. Now GeSHi filter is not working with FCKeditor. Do anyone have any idea why these modules are not working together.

Thanks in advance.

最佳回答

There is a rather complete answer in this post.

The post gives you some more details, but in essence is a matter of adding to the fckeditor.config.js file the following line:

FCKConfig.ProtectedSource.Add( /<blockcode language[sS]*?</blockcode>/gi  );

which essentially tells FCKeditor to leave the blockcode with syntax highlighting alone.

You can find some more details on the compatibility issues by visiting the FCKeditor module issue page, filtered for geshi.

Hope this helps!

问题回答

If I were you, I would switch to using the WYSIWYG module with TinyMCE amd use the Syntax Highlighter module for the syntax highlighting.

Follow these instructions for integrating the SyntaxHighlighter with TinyMCE - you can get a button that gives you a popup window from where you can select the language (php, MySQL, Bash etc etc) and enter your code.

You should probably also install my wysiwyg_preelementfix module, which ensures that characters are not escaped or double-escaped.

That is what I do on the KirkDesigns blog and it seems to work pretty well.

Failing that, I also wrote some instructions for using Geshi and FCKEditor together in Drupal

My suggestion for a code highlighter on a Drupal site would be a purely client side one, one that doesn t involve any hooks and any potential namespace conflicts.

The one I ve the most luck with in various environments (but never tried alongside FCKEditor) is google-code-prettify. If it doesn t work alongside FCKEditor you may want to have a look at the comments on getting it working with Wordpress since I think some of those problems may be related to FCKEditor.





相关问题
Drupal Multi-language: Simple strings not translated

I m adding additional languages to a Drupal site that I m building. Getting the translation of content working is fairly easy using the Internationalisation module. Yet, simple things such as date ...

Setting up a WYSIWYG editor for Drupal site users [closed]

Looking through the Drupal contrib modules, and after a few Google searches, it becomes evident that there are any number of choices and combos available to set up a WYSIWYG editor in Drupal. I m ...

Change size of user/password login box

I don t know how to change the size of the login username/password boxes on the drupal site that I m trying to build. I m stumbling through the theming, and don t know where to find the file that ...

How does Drupal provide an edit/review/publish model?

How does Drupal support a means to update and review a website before it is published? Does it only allow you to preview a page at a time before you publish it or is there a way to create a site ...

Term for rotating header

I m looking for terminology that describes this behavior: The header of a web-page contains a different image every time you visit it. Update: It is not an advertisement, but images related to the ...

Has anyone checked out Drupal 7? [closed]

Has anyone checked out a copy of Drupal 7 yet? What do people think? I m pretty excited about the PDO and all of the designers I work with a very excited about the new admin interface/structure. Do ...

热门标签