htmldiff.net
1.4.0
Package Description
Install-Package htmldiff.net -Version 1.4.0
dotnet add package htmldiff.net --version 1.4.0
<PackageReference Include="htmldiff.net" Version="1.4.0" />
paket add htmldiff.net --version 1.4.0
#r "nuget: htmldiff.net, 1.4.0"
Overview
HTMLDiff.net library for comparing two HTML files/snippets and highlighting the differences using simple HTML.
This HTML Diff implementation is a C# port of the ruby implementation found "here":https://github.com/myobie/htmldiff.
Example:
var oldText = @"<p><i>This is</i> some sample text to <strong>demonstrate</strong> the capability of the <strong>HTML diff tool</strong>.</p>
<p>It is based on the <b>Ruby</b> implementation found <a href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has no tooltip</p>
<p>What about a number change: 123456?</p>
<table cellpadding='0' cellspacing='0'>
<tr><td>Some sample text</td><td>Some sample value</td></tr>
<tr><td>Data 1 (this row will be removed)</td><td>Data 2</td></tr>
</table>
Here is a number 2 32
<br><br>
This date: 1 Jan 2016 is about to change (note how it is treated as a block change!)";
var newText = @"<p>This is some sample <strong>text to</strong> demonstrate the awesome capabilities of the <strong>HTML <u>diff</u> tool</strong>.</p><br/><br/>Extra spacing here that was not here before.
<p>It is <i>based</i> on the Ruby implementation found <a title='Cool tooltip' href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has a tooltip now and the HTML diff algorithm has preserved formatting.</p>
<p>What about a number change: 123356?</p>
<table cellpadding='0' cellspacing='0'>
<tr><td>Some sample <strong>bold text</strong></td><td>Some sample value</td></tr>
</table>
Here is a number 2 <sup>32</sup>
<br><br>
This date: 22 Feb 2017 is about to change (note how it is treated as a block change!)";
var diffHelper = new HtmlDiff.HtmlDiff(oldText, newText);
// Lets add a block expression to group blocks we care about (such as dates)
diffHelper.AddBlockExpression(new Regex(@"[\d]{1,2}[\s]*(Jan|Feb)[\s]*[\d]{4}", RegexOptions.IgnoreCase));
var diffHtml = diffHelper.Build();
Overview
HTMLDiff.net library for comparing two HTML files/snippets and highlighting the differences using simple HTML.
This HTML Diff implementation is a C# port of the ruby implementation found "here":https://github.com/myobie/htmldiff.
Example:
var oldText = @"<p><i>This is</i> some sample text to <strong>demonstrate</strong> the capability of the <strong>HTML diff tool</strong>.</p>
<p>It is based on the <b>Ruby</b> implementation found <a href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has no tooltip</p>
<p>What about a number change: 123456?</p>
<table cellpadding='0' cellspacing='0'>
<tr><td>Some sample text</td><td>Some sample value</td></tr>
<tr><td>Data 1 (this row will be removed)</td><td>Data 2</td></tr>
</table>
Here is a number 2 32
<br><br>
This date: 1 Jan 2016 is about to change (note how it is treated as a block change!)";
var newText = @"<p>This is some sample <strong>text to</strong> demonstrate the awesome capabilities of the <strong>HTML <u>diff</u> tool</strong>.</p><br/><br/>Extra spacing here that was not here before.
<p>It is <i>based</i> on the Ruby implementation found <a title='Cool tooltip' href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has a tooltip now and the HTML diff algorithm has preserved formatting.</p>
<p>What about a number change: 123356?</p>
<table cellpadding='0' cellspacing='0'>
<tr><td>Some sample <strong>bold text</strong></td><td>Some sample value</td></tr>
</table>
Here is a number 2 <sup>32</sup>
<br><br>
This date: 22 Feb 2017 is about to change (note how it is treated as a block change!)";
var diffHelper = new HtmlDiff.HtmlDiff(oldText, newText);
// Lets add a block expression to group blocks we care about (such as dates)
diffHelper.AddBlockExpression(new Regex(@"[\d]{1,2}[\s]*(Jan|Feb)[\s]*[\d]{4}", RegexOptions.IgnoreCase));
var diffHtml = diffHelper.Build();
Release Notes
Version 1.4 - dotnet standard2.0 support
Dependencies
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
Used By
NuGet packages (3)
Showing the top 3 NuGet packages that depend on htmldiff.net:
Package | Downloads |
---|---|
SitecoreSidekickContentMigrator
Easily move production Sitecore content to pre-production environments with this Sidekick module.
|
|
SitecoreSidekickAuditLog
An app to graphically log and search author activity within Sitecore.
|
|
Blazorme.Diff
Diff component library for Blazor apps.
It will render diff of the two input strings in different output display formats.
It can also be used as a library to get diff or html diff output strings from code behind.
|
GitHub repositories
This package is not used by any popular GitHub repositories.