treated as atoms even though the nodes have children. This is common
for things like string literals or interpolated strings, where the
node might have children for the opening and closing quote.`atom_nodes`是一个树形节点名称的列表,这些节点应被视为原子。即使这些节点有子节点,也应被视为原子。这对于字符串表面之或插值字符串非常常见的,因为在这种情况下,节点可能有用来表示开头和结尾的引用号。
If you don't set `atom_nodes`, you may notice added/removed content
is a useful source of common file extensions.也可能有与你的语言相关的文件名或shebangs。[GitHub的语言定义](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)是针对常见文件扩展名的一个有用来源。
## Syntax highlighting (Optional)语法高亮(可选)
## 语法高亮(可选)
To add syntax highlighting for your language, you'll also need a symlink
not support binary crates today](https://difftastic.wilfred.me.uk/rustdoc/difft/).Difftastic的内部文档在docs.rs上没有提供,因为它[不支持二进制工具箱](https://difftastic.wilfred.me.uk/rustdoc/difft/)。
## Testing测试
## 测试
```
```
$ cargo test
$ cargo test
```
```
There are also several files in `sample_files/` that you can use.在`sample_files/`中也有几个文件你可以使用。
在`sample_files/`中也有几个文件你可以使用。
The best way to test difftastic is to look at history from a real
tools](https://git-scm.com/docs/diff-config#Documentation/diff-config.txt-diffexternal). You
can use `GIT_EXTERNAL_DIFF` for a one-off git command.Git[支持使用外部的diff工具](https://git-scm.com/docs/diff-config#Documentation/diff-config.txt-diffexternal)。你可以使用`GIT_EXTERNEL_DIFF`来进行一键git命令。
for viewing the current changes with a different diff tool. It's
useful if you want to use difftastic occasionally.[git difftool](https://git-scm.com/docs/git-difftool) 是一款使用不同diff工具来查看当前修改的git命令。如果你想要偶尔使用Difftastic的话,这将会非常有用。
## Installing via homebrew (on macOS or Linux)通过homebrew安装(在macos或者Linux平台)
## 通过homebrew安装(在macos或者Linux平台)
Difftastic can be installed with [Homebrew](https://formulae.brew.sh/formula/difftastic) on macOS or Linux.Difftastic可以用[Homebrew](https://formulae.brew.sh/formula/difftastic)安装在macOS或Linux上。
recommend [rustup](https://rustup.rs/) to install Rust. Difftastic
requires Rust version 1.57 or later.Difftasitc是使用Rust编写的,所以你需要安装Rust。我推荐使用[rustup](https://rustup.rs/)来安装Rust。
You will also need a C++ compiler that supports C++14. If you're using
同时你也需要一个支持C++14的C++编译器。如果你正在使用GCC,则GCC版本至少为8。
GCC, you need at least version 8.同时你也需要一个支持C++14的C++编译器。如果你正在使用GCC,则GCC版本至少为8。
### Build编译
### Build编译
You can download and build [difftastic on
你可以下载并通过Cargo(它是Rust的一部分)来编译[difftastic on
crates.io](https://crates.io/crates/difftastic) with Cargo (which is
part of Rust).你可以下载并通过Cargo(它是Rust的一部分)来编译[difftastic on
crates.io](https://crates.io/crates/difftastic) 。
crates.io](https://crates.io/crates/difftastic) 。
```
```
$ cargo install difftastic
$ cargo install difftastic
```
```
Difftastic uses the `cc` crate for building C/C++ dependencies. This
Difftastic使用`cc`程序箱来构建C/C++的依赖关系。这使得你可以通过环境变量`CC`和`CXX`来控制使用的编译器(参照see [the cc
allows you to use environment variables `CC` and `CXX` to control the
compiler used (see [the cc
docs](https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables)). Difftastic使用`cc`程序箱来构建C/C++的依赖关系。这使得你可以通过环境变量`CC`和`CXX`来控制使用的编译器(参照see [the cc
specification](https://specifications.freedesktop.org/shared-mime-info-spec/0.11/ar01s03.html). The
database should be at one of the following paths:MIME数据库的路径[是在XDG的规定下](https://specifications.freedesktop.org/shared-mime-info-spec/0.11/ar01s03.html):
records which features and bug fixes are in each version. 该说明书会表明当前版本DFT_VERSION_HERE。[变更记录](https://github.com/Wilfred/difftastic/blob/master/CHANGELOG.md)会记录每个版本的特性增加和bug的修复。
## 语法差异分析
## 语法差异分析
Difftastic [detects the language](./usage.html#language-detection), parses the code, and then
git's `--word-diff`). They still don't understand the code
though. Difftastic will always find matched delimiters: you can see
the closing `)` from `or_else` has been highlighted. 一些文本差异分析工具也会突出单词的变化(例如GitHub或者是git的`--word-diff`),但是它们无法做到理解代码本身。Difftastic永远会找到匹配的定界符:你可以看到`or_else`结尾出的`)`已经被突出显示。
## 另一种文本差异分析
## 另一种文本差异分析
If input files are not in a format that difftastic understands, it
-- mirrored under a CC BY-NC license) are great resources. 如果你对学术文献的摘要感兴趣,[这个帖子](http://useless-factor.blogspot.com/2008/01/matching-diffing-and-merging-xml.html)(和它[附带的论文](http://useless-factor.blogspot.com/2008/01/matching-diffing-and-merging-xml.html)--在CC BY-NC的许可下可以被复制)将是一个很好的资源。