Class DecorationSpan
A markup node that toggles text decorations for its contents.
public sealed class DecorationSpan : InlineContainer
- Inheritance
-
DecorationSpan
- Inherited Members
Constructors
DecorationSpan(Inline, TextDecoration)
Creates a decoration span from the given contents and decoration.
public DecorationSpan(Inline contents, TextDecoration decoration)
Parameters
contentsInlineThe decoration span's contents.
decorationTextDecorationThe decoration to apply to the contents.
DecorationSpan(Inline, TextDecoration, Func<TextDecoration, TextDecoration, TextDecoration>)
Creates a decoration span from the given contents and decoration.
public DecorationSpan(Inline contents, TextDecoration decoration, Func<TextDecoration, TextDecoration, TextDecoration> updateDecoration)
Parameters
contentsInlineThe decoration span's contents.
decorationTextDecorationThe decoration to apply to the contents.
updateDecorationFunc<TextDecoration, TextDecoration, TextDecoration>An operator that updates the decorations.
Properties
Decoration
Gets the decoration to apply. Text decorations are encoded as a bit field, so this field may specify zero or more decorations.
public TextDecoration Decoration { get; }
Property Value
- TextDecoration
The decoration to apply.
UpdateDecoration
Gets the binary operator that is used to update the text decoration of this span's contents. The first argument to the operator represents the previous text decoration, the second argument represents the text decoration supplied by a span and the return value are the final text decorations for this span's contents.
public Func<TextDecoration, TextDecoration, TextDecoration> UpdateDecoration { get; }
Property Value
- Func<TextDecoration, TextDecoration, TextDecoration>
A binary operator.
Methods
IntersectDecorations(TextDecoration, TextDecoration)
Computes the intersection of two text decorations.
public static TextDecoration IntersectDecorations(TextDecoration first, TextDecoration second)
Parameters
firstTextDecorationThe first text decoration.
secondTextDecorationThe second text decoration.
Returns
- TextDecoration
The intersection of the text decorations.
Lower()
Attempts to express this inline node in simpler semantic markup.
public override Inline Lower()
Returns
MakeBold(Inline)
Renders a node in bold.
public static DecorationSpan MakeBold(Inline node)
Parameters
nodeInlineThe node to render in bold.
Returns
- DecorationSpan
A decoration span that renders the node in bold.
MakeItalicized(Inline)
Renders a node in italics.
public static DecorationSpan MakeItalicized(Inline node)
Parameters
nodeInlineThe node to render in italics.
Returns
- DecorationSpan
A decoration span that renders the node in italics.
MakeStruckthrough(Inline)
Renders a node in strikethrough mode.
public static DecorationSpan MakeStruckthrough(Inline node)
Parameters
nodeInlineThe node to render in strikethrough mode.
Returns
- DecorationSpan
A decoration span that renders the node in strikethrough mode.
MakeUnderlined(Inline)
Renders a node in underline mode.
public static DecorationSpan MakeUnderlined(Inline node)
Parameters
nodeInlineThe node to render in underline mode.
Returns
- DecorationSpan
A decoration span that renders the node in underline mode.
ReplaceDecorations(TextDecoration, TextDecoration)
Returns the second text decoration.
public static TextDecoration ReplaceDecorations(TextDecoration first, TextDecoration second)
Parameters
firstTextDecorationThe first text decoration.
secondTextDecorationThe second text decoration.
Returns
- TextDecoration
The second text decoration.
ToggleDecorations(TextDecoration, TextDecoration)
Computes the exclusive or of two text decorations.
public static TextDecoration ToggleDecorations(TextDecoration first, TextDecoration second)
Parameters
firstTextDecorationThe first text decoration.
secondTextDecorationThe second text decoration.
Returns
- TextDecoration
The exclusive or of the text decorations.
UnifyDecorations(TextDecoration, TextDecoration)
Computes the union of two text decorations.
public static TextDecoration UnifyDecorations(TextDecoration first, TextDecoration second)
Parameters
firstTextDecorationThe first text decoration.
secondTextDecorationThe second text decoration.
Returns
- TextDecoration
The union of the text decorations.
WithContents(Inline)
Creates a copy of this node with new contents.
public override InlineContainer WithContents(Inline newContents)
Parameters
newContentsInline