From 4b7bda95101ca8a60364249923737c6d356a17cd Mon Sep 17 00:00:00 2001 From: Laurent Aerens Date: Tue, 20 Feb 2024 16:43:18 +0100 Subject: [PATCH 1/2] Add HTML entity replacements for tab and space characters --- csharp/DiffMatchPatch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/DiffMatchPatch.cs b/csharp/DiffMatchPatch.cs index 6e196418..d97f9b5f 100644 --- a/csharp/DiffMatchPatch.cs +++ b/csharp/DiffMatchPatch.cs @@ -1338,7 +1338,7 @@ public string diff_prettyHtml(List diffs) { StringBuilder html = new StringBuilder(); foreach (Diff aDiff in diffs) { string text = aDiff.text.Replace("&", "&").Replace("<", "<") - .Replace(">", ">").Replace("\n", "¶
"); + .Replace(">", ">").Replace("\n", "¶
").Replace("\t", " ").Replace(" ", " "); switch (aDiff.operation) { case Operation.INSERT: html.Append("").Append(text) From 806cbe9f547bd16b7ddfa78d4f4a10cfcd9df5ba Mon Sep 17 00:00:00 2001 From: Laurent Aerens Date: Tue, 20 Feb 2024 16:43:18 +0100 Subject: [PATCH 2/2] Add HTML entity replacements for tab and space characters --- csharp/DiffMatchPatch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/DiffMatchPatch.cs b/csharp/DiffMatchPatch.cs index 6e196418..d97f9b5f 100644 --- a/csharp/DiffMatchPatch.cs +++ b/csharp/DiffMatchPatch.cs @@ -1338,7 +1338,7 @@ public string diff_prettyHtml(List diffs) { StringBuilder html = new StringBuilder(); foreach (Diff aDiff in diffs) { string text = aDiff.text.Replace("&", "&").Replace("<", "<") - .Replace(">", ">").Replace("\n", "¶
"); + .Replace(">", ">").Replace("\n", "¶
").Replace("\t", " ").Replace(" ", " "); switch (aDiff.operation) { case Operation.INSERT: html.Append("").Append(text)