JavaScript library for syntax highlighting for code, then diffs, in HTML, at the line level?

StackOverflow https://stackoverflow.com/questions/225597

  •  03-07-2019
  •  | 
  •  

Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

https://github.com/cemerick/jsdifflib

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top