简体   繁体   English

JavaScript库可用于在行级突出显示代码的语法,然后突出显示HTML的差异?

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

Anyone know of a JS library that will allow me to syntax highlight a code block, then highlight line-level diffs? 谁知道有一个JS库可以让我语法突出显示代码块,然后突出显示行级差异? 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). 例如,在Subversion差异中,我要突出显示行中已更改的字符(以及突出显示行中存在更改的事实)。

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. 我看到Gallio现在针对其不相等的assertion-exceptions进行了此操作,但尚未对此进行研究。

I've used this to generate diffs of code in a browser -- it's excellent 我用它来在浏览器中生成代码差异-很棒

https://github.com/cemerick/jsdifflib https://github.com/cemerick/jsdifflib

It's line level, but you might be able to use it as a base. 它是线路级别,但您可能可以将其用作基础。

The Google Syntax Highlighter is great, and supports lots of languages. Google语法荧光笔很棒,并且支持多种语言。 I'm not sure if it supports diffs though, but I think it's quite extensible. 我不确定它是否支持差异,但是我认为它是可扩展的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM