forked from TeamInklings/Octobot
32 lines
734 B
C#
32 lines
734 B
C#
|
using System.Text;
|
|||
|
using DiffPlex.DiffBuilder.Model;
|
|||
|
|
|||
|
namespace Octobot.Extensions;
|
|||
|
|
|||
|
public static class DiffPaneModelExtensions
|
|||
|
{
|
|||
|
public static string AsMarkdown(this DiffPaneModel model)
|
|||
|
{
|
|||
|
var builder = new StringBuilder();
|
|||
|
foreach (var line in model.Lines)
|
|||
|
{
|
|||
|
if (line.Type is ChangeType.Deleted)
|
|||
|
{
|
|||
|
builder.Append("- ");
|
|||
|
}
|
|||
|
|
|||
|
if (line.Type is ChangeType.Inserted)
|
|||
|
{
|
|||
|
builder.Append("+ ");
|
|||
|
}
|
|||
|
|
|||
|
if (line.Type is not ChangeType.Imaginary)
|
|||
|
{
|
|||
|
builder.AppendLine(line.Text);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return builder.ToString().InBlockCode("diff");
|
|||
|
}
|
|||
|
}
|