views:

91

answers:

2

I'm looking for a customizable JavaScript script which dynamically highlights code in a block like

<code class="someclass">source code...</code>

It needs to be customizable because the source code is in a quite esoteric programming language (Mozart/Oz). Ideally, I'd just edit some regexes to make it work.

I need dynamic highlighting because it should work in the github wiki which escapes all HTML code within a pre tag.

My Google fu has forsaken me so far...

+1  A: 

SyntaxHighlighter might be what you're looking for. It supports custom languages, as well.

David Brown
Looks good. I will check it out. Thanks!
wmeyer
A: 

jQuery Syntax Highlighter is a new one based on version 3 of Alex Gorbatchev's Syntax Highlighter - a really really really popular plain javascript syntax highlighter.

It supports such things as code and pre blocks, able to use classnames like language-javascript to indicate we want it to highlight, as well as wordwrap. You can copy and paste code by selecting it normally instead of having to open a raw view like many others. It can be further customised by using the HTML5 data attribute data-sh or via specifying options at initialisation. A great stable choice which is updated regularly.

balupton