Docsv3.31.0
Back to API Reference
Class

TagParseRule

abstract
Inherits:ParseRule

Base class for parsing XML-style markup tags (e.g., <b>, <color=#FF0000>).

Remarks

Derived classes override TagName to specify the tag name to match. Parameters are always optional: <tag>, <tag=value>, <tag/>, <tag=value/>. Self-closing is purely syntax-driven via />.

Derived Types(1)

Types that inherit from TagParseRule.

public string TagName{ get }
public string SourceToken{ get }
public string Identity{ get }
public string MarkupTriggers{ get }
public string TypingTriggers{ get }
protected bool IsVoid{ get }

When true, the tag has HTML void-element semantics: every <tag> or <tag=value> form is treated as self-closing (produces a single  placeholder), and a stray </tag> is silently consumed. Use for inline-media tags (obj, sprite) where range semantics don't apply.

public bool CanWrap{ get }

Whether Apply emits a content-wrapping form — i.e. the rule can express an inline style application. Rules that override Apply to return syntax must also override this; consumers gate on it instead of probing Apply with empty input.

public string SelfClosing(string parameter)

The self-closing occurrence of this tag (object inserts): <tag/> or <tag=param/>; null when the rule has no tag name.

public override void Reset()
public override string Apply(ReadOnlySpan<char> content, string parameter)

Void tags have no wrapping form (return null); otherwise wraps content in the open/close tag pair.

public override void Finalize(ReadOnlySpan<char> text, PooledList<ParsedRange> results)
public override int TryMatch(ReadOnlySpan<char> text, int index, PooledList<ParsedRange> results)

See Also