作为一个Web应用程序的一部分,我需要显示UNIX差异(这我通过REST调用作为字符串获取),并以彩色编码格式显示。
我试着使用diff2Html库,但它只接受混帐风格不同之处或统一的diff格式。
下面是来自API调用输出
"2,4c2,4\n< I need to run the laundry.\n< I need to wash the dog.\n< I need to get the car detailed.\n---\n> I need to do the laundry.\n> I need to wash the car.\n> I need to get the dog detailed."
这是本UNIX差异的字符串版本:
2,4c2,4
< I need to run the laundry.
< I need to wash the dog.
< I need to get the car detailed.
---
> I need to do the laundry.
> I need to wash the car.
> I need to get the dog detailed.
有要么这个输出转换成统一的格式,或一个JavaScript工具,它以这种格式输入和prettifies它的工具吗?