Class TextDiff

Namespace
Pixie.Markup
Assembly
Pixie.dll

A node that visualizes a diff of a pair of strings.

public sealed class TextDiff : Inline
Inheritance
TextDiff
Inherited Members

Constructors

TextDiff(Diff<char>, IReadOnlyDictionary<DiffOperation, Color>)

Creates a text diff node.

public TextDiff(Diff<char> diff, IReadOnlyDictionary<DiffOperation, Color> operationColors)

Parameters

diff Diff<char>

The diff to render.

operationColors IReadOnlyDictionary<DiffOperation, Color>

A dictionary that maps diff operations to the color in which diff elements that use those operations are painted. Diff operations that do not appear as keys in the dictionary are not rendered, except for Unchanged, which is rendered without color if it does not show up as a key.

Properties

Diff

Gets the diff to render.

public Diff<char> Diff { get; }

Property Value

Diff<char>

The diff to render.

OperationColors

Gets a dictionary that maps diff operations to the color in which diff elements that use those operations are painted. Diff operations that do not appear as keys in the dictionary are not rendered, except for Unchanged, which is rendered without color if it does not show up as a key.

public IReadOnlyDictionary<DiffOperation, Color> OperationColors { get; }

Property Value

IReadOnlyDictionary<DiffOperation, Color>

A mapping of diff operations to colors.

Methods

Lower()

Attempts to express this inline node in simpler semantic markup.

public override Inline Lower()

Returns

Inline

RenderAll(Diff<char>)

Creates a text diff that renders the both the deletions and insertions in a diff.

public static TextDiff RenderAll(Diff<char> diff)

Parameters

diff Diff<char>

A diff to render.

Returns

TextDiff

A text diff node that renders all diff elements.

RenderDeletions(Diff<char>)

Creates a text diff that renders the deletions in a diff.

public static TextDiff RenderDeletions(Diff<char> diff)

Parameters

diff Diff<char>

A diff to render.

Returns

TextDiff

A text diff node that renders deletions and unchanged diff elements only.

RenderInsertions(Diff<char>)

Creates a text diff that renders the insertions in a diff.

public static TextDiff RenderInsertions(Diff<char> diff)

Parameters

diff Diff<char>

A diff to render.

Returns

TextDiff

A text diff node that renders insertions and unchanged diff elements only.