相当差异的用法 [英] Pretty Diff Usage
本文介绍了相当差异的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的小网站项目中使用这个梦幻般的Javascript库。
I want to use this fantastic Javascript Library on my little web project.
我已经下载了PrettyDiff.js和ViewDiff.js
I've downloaded PrettyDiff.js and ViewDiff.js
我一直在研究如何使用它,我似乎找不到任何关于如何获取Javascript / Jquery输出的例子
I've been researching on how to use it and I can't seem to find any examples on how to get the output for Javascript/Jquery
这就是我到目前为止。
<script xmlns="http://www.w3.org/1999/xhtml" type="application/javascript" src="prettydiff.js"></script>
<script xmlns="http://www.w3.org/1999/xhtml" type="application/javascript" src="diffview.js"></script>
<link xmlns="http://www.w3.org/1999/xhtml" href="diffview.css" media="all" rel="stylesheet" type="text/css" />
<script type="application/javascript">
$(document).ready(function () {
var pd = new prettydiff();
var dv = new diffview();
});
</script>
我有两个文本区域和按钮放置但我似乎没有找到该功能开始演出。
I have the two text areas and the button placed but I just don't seem to find the function to start the show.
我们非常感谢任何文件或代码。
Any documentation or code would be much appreciated.
干杯
推荐答案
var str = "<html><body><h1>hello</h1></body><html>";
// Options can be viewed at:
// http://prettydiff.com/documentation.xhtml#function_properties
var options = {
source: str,
mode : "beautify", // beautify, diff, minify, parse
lang : "html",
wrap : 100,
inchar : "\t", // indent character
insize : 1 // number of indent characters per indent
}
var pd = prettydiff(options); // returns and array: [beautified, report]
var pretty = pd[0];
var report = pd[1];
console.log(pretty);
console.log(report);
这篇关于相当差异的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文