This project is read-only.

SyntaxHighlighter with integrated codehighlighting for tinymce

Topics: ASP.NET 2.0, Controls
Sep 27, 2008 at 9:35 AM

It took me an extra ordinary long amount of time to finally get a decent code formatter/highlighter working. In the included zip is everything you need to get it going.

A few tips:
-Enable "SyntaxHighlighter" plugin.
-Don’t forget to disable any other extensions that do code formatting such as "CodeFormatterExtension".
-Your browser caches the js files for tinymce, so you will need to clear your cache to get the latest js files once they have been updated.
-A quick "iisreset" will solve any hassles caused by changing "tinyMCE.ascx".


The patch includes:
TinyMCE Editor
codehighlighting plugin for TinyMCE Editor 3.x (I modified it to allow the choice of pre or textarea and to use the "lang" attribute instead of "name attribute")
SyntaxHighlighter (I modified syntax highlighter to use the "lang" attribute instead of the "name" attribute when working out if it should be applied)
Also made changes to tinyMCE.ascx to make it work with TinyMCE 3.x and SyntaxHighlighter (pre tag needs certain attributes enabled so it will not be removed by code cleanup)
SyntaxHighlighter Extension for BlogEngineNET (I just modified the path of where files where located and enabled sql highlighter)

Latest versions of code:

Other related posts:
Sep 27, 2008 at 2:34 PM
Edited Sep 27, 2008 at 3:15 PM
Hi, I tried to implement this and get;

The files '/blog/App_Code/ExtensionManager/ExtensionParameter.cs' and '/blog/App_Code/Extensions/SyntaxHighlighter/Scripts/shBrushDelphi.js' use a different language, which is not allowed since they need to be compiled together.

This happens when the 'SyntaxHighlighter' folder is put into APP_CODE\Extensions.

Any ideas?
Sep 27, 2008 at 2:42 PM
It looks promising. Will it be integrated in the next release/SP of BE?

Sep 29, 2008 at 9:36 AM
I forget to add that I have only test this on the 1.4.5 version of Blog Engine .Net.

You should be able to simply extract the folder in the root directory of Blog Engine .Net.

I do not recommend placing the SyntaxHighlighter folder under App_Code as it is a folder containing the javascript code and css to run on client side. It is a 100% client side solution, as such it does not get compiled at all. This is why I placed it under the root directory and treated as normal static content like gifs, html and css.

Sep 29, 2008 at 9:38 AM
It would be nice to have it included in the next release. I don't have any idea on how to get it included though. I am pretty sure that a lot of programmers would switch to Blog Engine .Net if it was simple to get code syntax highlighting working.