Table of Contents

Class MarkdownNodeBuilder

Namespace
HeyBox
Assembly
HeyBox.Net.Core.dll

用来构建 MarkdownNode 元素的构建器。

public class MarkdownNodeBuilder : ITextNodeBuilder, INodeBuilder, IEquatable<MarkdownNodeBuilder>, IEquatable<INodeBuilder>
Inheritance
MarkdownNodeBuilder
Implements
Inherited Members

Constructors

MarkdownNodeBuilder()

初始化一个 MarkdownNodeBuilder 类的新实例。

public MarkdownNodeBuilder()

MarkdownNodeBuilder(string?, NodeWidth?)

初始化一个 MarkdownNodeBuilder 类的新实例。

public MarkdownNodeBuilder(string? text, NodeWidth? width = null)

Parameters

text string

Markdown 文本内容。

width NodeWidth?

节点的宽度。

Fields

MaxMarkdownLength

Markdown 文本的最大长度。

public const int MaxMarkdownLength = 10000

Field Value

int

Properties

Text

获取或设置 Markdown 的文本内容。

public string? Text { get; set; }

Property Value

string

Type

获取此构建器构建的节点的类型。

public NodeType Type { get; }

Property Value

NodeType

Width

获取或设置此构建器构建的节点的大小。

public NodeWidth? Width { get; set; }

Property Value

NodeWidth?

Methods

Build()

构建当前构建器为一个 MarkdownNode

public MarkdownNode Build()

Returns

MarkdownNode

由当前构建器表示的属性构建的 MarkdownNode 对象。

Exceptions

ArgumentNullException

Textnull

ArgumentException

Text 的长度超过了 MaxMarkdownLength

Equals(MarkdownNodeBuilder?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(MarkdownNodeBuilder? markdownNodeBuilder)

Parameters

markdownNodeBuilder MarkdownNodeBuilder

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

WithText(string)

设置 Markdown 的文本内容,值将被设置到 Text 属性上。

public MarkdownNodeBuilder WithText(string text)

Parameters

text string

Markdown 的文本内容。

Returns

MarkdownNodeBuilder

当前构建器。

WithWidth(NodeWidth)

设置节点的宽度,值将被设置到 Width 属性上。

public MarkdownNodeBuilder WithWidth(NodeWidth width)

Parameters

width NodeWidth

节点的宽度。

Returns

MarkdownNodeBuilder

当前构建器。

Operators

operator ==(MarkdownNodeBuilder?, MarkdownNodeBuilder?)

判定两个 MarkdownNodeBuilder 是否相等。

public static bool operator ==(MarkdownNodeBuilder? left, MarkdownNodeBuilder? right)

Parameters

left MarkdownNodeBuilder
right MarkdownNodeBuilder

Returns

bool

如果两个 MarkdownNodeBuilder 相等,则为 true;否则为 false

implicit operator MarkdownNodeBuilder(string)

使用指定的 Markdown 文本内容初始化一个新的 MarkdownNodeBuilder 类的实例。

public static implicit operator MarkdownNodeBuilder(string content)

Parameters

content string

Markdown 文本内容。

Returns

MarkdownNodeBuilder

一个使用指定的 Markdown 文本内容初始化的 MarkdownNodeBuilder 类的实例。

operator !=(MarkdownNodeBuilder?, MarkdownNodeBuilder?)

判定两个 MarkdownNodeBuilder 是否不相等。

public static bool operator !=(MarkdownNodeBuilder? left, MarkdownNodeBuilder? right)

Parameters

left MarkdownNodeBuilder
right MarkdownNodeBuilder

Returns

bool

如果两个 MarkdownNodeBuilder 不相等,则为 true;否则为 false