gitbook 入门教程之比较代码块差异 diff 插件.docx

上传人:A*** 文档编号:142724218 上传时间:2020-08-22 格式:DOCX 页数:13 大小:233.01KB
返回 下载 相关 举报
gitbook 入门教程之比较代码块差异 diff 插件.docx_第1页
第1页 / 共13页
gitbook 入门教程之比较代码块差异 diff 插件.docx_第2页
第2页 / 共13页
gitbook 入门教程之比较代码块差异 diff 插件.docx_第3页
第3页 / 共13页
gitbook 入门教程之比较代码块差异 diff 插件.docx_第4页
第4页 / 共13页
gitbook 入门教程之比较代码块差异 diff 插件.docx_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《gitbook 入门教程之比较代码块差异 diff 插件.docx》由会员分享,可在线阅读,更多相关《gitbook 入门教程之比较代码块差异 diff 插件.docx(13页珍藏版)》请在金锄头文库上搜索。

1、gitbook 入门教程之比较代码块差异 diff 插件在 markdown 文档中显示代码之间的差异的 Gitbook 插件English | 中文 主页 Github : https:/snowdreams1006.github.io/gitbook-plugin-diff/ GitLab: https:/snowdreams1006.gitlab.io/gitbook-plugin-diff/ Gitee : https:/snowdreams1006.gitee.io/gitbook-plugin-diff/屏幕截图 用法% diff method=diffJson %json nam

2、e: gitbook-plugin-simple-mind-map, version: 0.2.1, description: A gitBook plugin for generating and exporting mind map within markdownjson name: gitbook-plugin-diff, version: 0.2.1, description: A gitbook plugin for showing the differences between the codes within markdown% enddiff % 预览- description

3、: A gitBook plugin for generating and exporting mind map within markdown,- name: gitbook-plugin-simple-mind-map,+ description: A gitbook plugin for showing the differences between the codes within markdown,+ name: gitbook-plugin-diff, version: 0.2.1用法步骤1-更新 book.json 文件在您的 gitbook 的 book.json 文件中,将

4、diff 添加到 plugins 列表中.这是最简单的示例: plugins: diff此外,受支持的配置选项如下:gitbook: properties: method: type: string, title: jsdiff api method, required: false, default: diffLines, description: some supported methods such as diffChars or diffWords or diffWordsWithSpace or diffLines or diffTrimmedLines or diffSentenc

5、es or diffCss or diffJson or diffArrays , options: type: object, title: jsdiff api options, required: false, description: some methods may not support options 步骤2- 使用 markdown 语法diff 插件支持 method 和 options 等选项生成差异代码块.这是在 markdown 文件中基本使用语法:% diff %old codenew code% enddiff %下面有一些基本示例:Diff.diffChars(o

6、ldStr, newStr, options)区分两个文本块,逐个字符比较。返回返回更改对象列表(请参见下文)。选项 ignoreCase : true忽略大小写差异。默认为false 。示例 用法设置method=diffChars以调用Diff.diffChars(oldStr, newStr, options)方法% diff method=diffChars %jscatjscap% enddiff % 预览 ca- t+ pDiff.diffWords(oldStr, newStr, options)区分两个文本块,逐字比较,忽略空格。返回返回更改对象列表(请参见下文)。选项 ign

7、oreCase :与diffChars相同。示例 用法设置method=diffWords来调用Diff.diffWords(oldStr, newStr, options)方法% diff method=diffWords %bashbeep boopbashbeep boob blah% enddiff % 预览 beep- boop+ boob+ blahDiff.diffWordsWithSpace(oldStr, newStr, options)区分两个文本块,逐字比较,将空白视为有效。返回返回更改对象列表(请参见下文)。选项 ignoreCase :与diffWords相同。示例

8、用法设置method=diffWordsWithSpace以调用Diff.diffWordsWithSpace(oldStr, newStr, options)方法% diff method=diffWordsWithSpace %bashbeep boopbashbeep boob blah% enddiff % 预览 beep- boop+ boob blahDiff.diffLines(oldStr, newStr, options)比较两个文本块,逐行比较。返回返回更改对象列表(请参见下文)。选项 ignoreWhitespace : true忽略前导和尾随空白。这与diffTrimm

9、edLines相同 newlineIsToken : true newlineIsToken换行符视为单独的标记。这允许换行结构的更改独立于行内容而发生,并照此处理。通常,这是diffLines更加人性化的形式,并且diffLines更适合于补丁和其他计算机友好的输出。示例 用法设置method=diffLines以调用Diff.diffLines(oldStr, newStr, options)方法% diff method=diffLines,options=newlineIsToken:true %bashbeep boopthe cat is palying with capwhatb

10、ashbeep boob blahthe cat is palying with capwho% enddiff % 预览- beep boop+ beep boob blah the cat is palying with cap- what+ whoDiff.diffTrimmedLines(oldStr, newStr, options)区分两个文本块,逐行比较,忽略前导和尾随空格。返回返回更改对象列表(请参见下文)。选项 ignoreWhitespace :与diffLines相同。 newlineIsToken :同diffLines 。示例 用法设置method=diffTrimm

11、edLines来调用Diff.diffTrimmedLines(oldStr, newStr, options)方法% diff method=diffTrimmedLines,options=newlineIsToken:true %bashbeep boopthe cat is palying with capwhatbashbeep boob blahthe cat is palying with catwho% enddiff % 预览- beep boop the cat is palying with cap what+ beep boob blah the cat is paly

12、ing with cat whoDiff.diffSentences(oldStr, newStr, options)区分两个文本块,逐句比较。返回返回更改对象列表(请参见下文)。示例 用法设置method=diffSentences来调用Diff.diffSentences(oldStr, newStr, options)方法% diff method=diffSentences %bashbeep boopthe cat is palying with capwhatbashbeep boob blahthe cat is palying with catwho% enddiff % 预览

13、- beep boop the cat is palying with cap what+ beep boob blah the cat is palying with cat whoDiff.diffCss(oldStr, newStr, options)比较两个文本块,比较 CSS 标记。返回返回更改对象列表(请参见下文)。示例 用法设置method=diffCss来调用Diff.diffCss(oldStr, newStr, options)方法% diff method=diffCss %css.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号