Description
n8n-nodes-text-diff
This is an n8n community node that provides text comparison and diff functionality using the popular diff package.
Features
The Text Diff node offers several text comparison operations:
- Character Diff: Compare texts character by character
- Word Diff: Compare texts word by word
- Line Diff: Compare texts line by line
- Sentence Diff: Compare texts sentence by sentence
- Create Patch: Generate unified diff patches
Installation
Follow the installation guide in the n8n community nodes documentation.
Community Nodes (Recommended)
- Go to Settings > Community Nodes
- Select Install
- Enter
n8n-nodes-text-diff - Agree to the risks of using community nodes and select Install
After installation restart n8n to use the node.
Manual Installation
To get started install the package in your n8n root directory:
npm install n8n-nodes-text-diff
For Docker-based deployments, add the following line before the font installation command in your n8n custom docker file:
RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-text-diff
Usage
- Add the "Text Diff" node to your workflow
- Configure the operation type (Character, Word, Line, Sentence, or Create Patch)
- Provide the original text and new text to compare
- Configure options like ignore case, ignore whitespace, output format, etc.
- Execute the node to get detailed diff results
Output Formats
- Detailed Changes: Complete change objects with metadata and statistics
- Summary Only: Just the summary statistics (counts of additions, removals, etc.)
- Changes Only: Only the actual changes without metadata
Example Output
For a word diff operation, you'll get:
{
"operation": "diffWords",
"summary": {
"totalChanges": 5,
"addedCount": 2,
"removedCount": 1,
"unchangedCount": 8,
"hasChanges": true
},
"changes": [
{ "count": 3, "value": "The quick " },
{ "count": 1, "added": true, "value": "red " },
{ "count": 1, "removed": true, "value": "brown " },
{ "count": 4, "value": "fox jumps" }
]
}
Compatibility
- Requires n8n v0.216.0 or later
- Compatible with all n8n deployment methods