Home > Uncategorized > SyntaxHighlighter mod for xhtml, css and blogger support.

SyntaxHighlighter mod for xhtml, css and blogger support.

Update :

New version of the mod is available under the name ‘gembox’. It supports xhtml, doesn’t require manually including brush files, and can be run within the header. You can get it from :

http://onursafak.com/projects/gembox/

More description about the usage will be available soon.

The post below is kept for historical purpose


Anybody remember the revolution of the 16 color computer displays?

SyntaxHighlighter by Alex Gorbatchev is a well written client side syntax highlighter which uses javascript to colorize output from different languages on web pages, using customizable brush files for language definitions. I’ve found it’s a good alternative for my needs and switched to it. Now it’s used by Byte Hell for colorized outputs.

Before this I made a little modification on the code for some features which are asked by current users of this nice tool.

For people already know about SyntaxHighlighter :

With the modification HighlightAll function gets the same parameters. It now checks for the ‘class’ attributes of the tags to highlight. This way it supports xhtml and blogger.com, keeps the name attributes available, and allows space seperated multiple styles in the class attribute, giving us the chance to attach custom styles to containers.

With the new syntax, the tags should be formed as below :

<pre class="hl:sql">......</pre>

Like before, options can be added to the class tag like: ‘hl:sql:collapse’, where ‘hl’ is the name which is passed to the ‘HighlightAll’ command, and ‘sql’ is the language alias.

The xhtml mod can be found at :

http://www.onursafak.com/tools/shx/shCore.js

You can download the package from it’s homepage and just replace this file.

Have a colorful day.

  1. Anonymous
    July 29th, 2008 at 06:48 | #1

    I replaced that file and now I get an error that tells me that dp.SyntaxHighlighter.HighlightAll is not a function. I looked at your file and I could not find it. Did you forget to include it?

    Thanks.

  2. Onur Safak
    July 29th, 2008 at 22:53 | #2

    Oh, just noticed that I put the new version over it by mistake, I uploaded it again.

    Btw; a new version is on the way, which dynamically includes brush files, so no more includes are needed. This will allow to work with dynamic content, through a google gadget for example.
    It’s currently used by this site and will be available for download in a few days.

  3. d.wachss
    August 5th, 2008 at 23:56 | #3

    The HighlightAll function is still not there.

  4. Onur Safak
    August 7th, 2008 at 13:25 | #4

    Oops, thanks for noticing.

    Appears it was always there, but the anchor link was falsely pointing to the new version named gembox. Fixed the link. Packaging Gembox version.

*