views:

88

answers:

3

Is there any API or a jQuery plugin that allow me to highlight a code on my website?

For example

<pre code="c#">
   var x = new StringBuilder();
   var complex = new Complex();
</pre>

<script type="text/javascript">
    $("pre[code]").codehighlight({ language: "c#" });
</script>

Something like that?

+8  A: 

Here are nine of them.

SLaks
A: 

I like google-code-prettify, because it comes with support for several languages (not all, though) and it's reasonably clear, simple, and well-documented how to add more (the classic SyntaxHilighter requires more work to add support for languages that aren't directly in it).

You should also look at Chili: I have no direct experience with it, but I hear it's based on jQuery, which seems like it might be a plus for you.

Alex Martelli
+2  A: 

About half of the world is using SyntaxHighlighter!

KMan