Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File diff souce code highlighting

various JavaScript libraries provide syntax highlighting functionality to display code on a webpage. Some example for those libraries are:

  • Ace (http://ace.c9.io/) - yes, I am aware that this is a whole editor
  • Prism JS (http://prismjs.com/)
  • SyntaxHighlighter (http://alexgorbatchev.com/SyntaxHighlighter/)
  • ...and many more...

However, these editors do not support highlighting chunks of a source file. I want to enable syntax highlighting for a diff like this one: https://github.com/reviewninja/review.ninja/commit/9bd4844f0009d3471dc010d9939262f4eb2603e5 .

I could not find a library supporting the describes scenario. Does any one of you guys know of a JavaScript library describing this scenario?

Thank you very much and best Regards,

Fabian

like image 928
german-software-123 Avatar asked Aug 28 '26 07:08

german-software-123


1 Answers

Most of these are inline syntax highlighting (which is what I assume you want, but some of them have side-by-side as well):

  • http://ejohn.org/projects/javascript-diff-algorithm/
  • jQuery Pretty Text Diff
  • Google Diff Match Patch
  • jsDiffLib | Demo
like image 132
trekforever Avatar answered Aug 29 '26 20:08

trekforever



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!