views:

306

answers:

2

Anyone know of a JS library that will allow me to syntax highlight a code block, then highlight line-level diffs? For example, in a subversion diff, I'd like to highlight the characters on the line that have changed (as well as highlighting the fact that there are change(s) on the line).

Edit: I'm after something that will let me syntax highlight according to the language, then syntax highlight the fact that it's a diff, and ideally, on top, highlight the changed-characters on the lines that have changed. I saw that Gallio now does this for its not-equal assertion-exceptions, but haven't looked at that yet.

A: 

I've used this to generate diffs of code in a browser -- it's excellent

http://snowtide.com/jsdifflib

It's line level, but you might be able to use it as a base.

Lou Franco
+2  A: 

The Google Syntax Highlighter is great, and supports lots of languages. I'm not sure if it supports diffs though, but I think it's quite extensible.

Ben Dowling