htmldiff.net
1.4.0
dotnet add package htmldiff.net --version 1.4.0
NuGet\Install-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"
// Install htmldiff.net as a Cake Addin
#addin nuget:?package=htmldiff.net&version=1.4.0
// Install htmldiff.net as a Cake Tool
#tool nuget:?package=htmldiff.net&version=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();
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
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.
Version 1.4 - dotnet standard2.0 support