Docsv2.12.12
Back to API Reference
Interface

IParseRule

abstract

Interface for custom text parsing rules that identify modifier application ranges.

Remarks

Parse rules scan text for markup (XML tags, Markdown, custom markers) and produce ParsedRange entries that specify where modifiers should be applied. Rules are matched in priority order (highest first). Use higher priority for explicit markup rules (tags, Markdown) and lower priority for auto-detection rules (raw URLs).

Implementations(14)

Types that implement IParseRule.

C
BackslashEscapeRule
Escapes a single ASCII punctuation character preceded by \. Example: \* becomes a literal * and is protected from any other parse rule.
C
CodeSpanRule
Protects content inside backtick-delimited code spans (e.g. `x`, ``x``, ```x```) from being processed by other parse rules. Follows CommonMark §6.1 balanced-run semantics: an N-backtick run is closed by the next N-backtick run of the same length.
C
CompositeParseRule
Combines multiple parse rules into a single rule.
C
LineBreakParseRule
Replaces the void <br> tag with a soft line break (U+2028 LINE SEPARATOR): the line wraps but stays in the same paragraph, keeping the surrounding direction and taking no inter-paragraph spacing — like HTML <br> or a word-processor Shift+Enter. A paragraph break is a literal newline (Enter) instead. Matches <br>, <br/> and <br /> case-insensitively with HTML void-element semantics: no closing tag, no nested content.
C
MarkdownLinkParseRule
Parses Markdown-style links: [link text](https://example.com).
C
MarkdownListParseRule
Parses Markdown-style lists (bulleted and numbered).
C
MarkdownWrapRule
Parses symmetric open/close markers in text (e.g., **text**, ~~text~~).
C
NoparseTagRule
Protects content inside <noparse>...</noparse> from being processed by any other parse rule. The markers themselves are stripped; the content between them appears verbatim in the output.
C
RangeRule
C
RawUrlParseRule
Auto-detects URLs in plain text and converts them to clickable links.
C
RubyParseRule
Parses ruby (furigana) markup into base + reading ranges for [[RubyModifier]].
C
SeparatorParseRule
Replaces the void separator tag (default <sep>) with the configured separator string and marks the inserted range for a paired [[SeparatorModifier]].
C
StringParseRule
Matches literal string patterns and optionally replaces them.
C
TagParseRule
Base class for parsing XML-style markup tags (e.g., <b>, <color=#FF0000>).
public int Priority{ get }

Gets the matching priority. Higher values are matched first. Default is 0. Use positive values for explicit markup, negative for auto-detection.

public bool IsStandalone{ get }

Indicates whether this rule operates without a modifier (e.g., protection rules like noparse). When, the rule can be registered via UniText.RegisterRule without pairing it with a BaseModifier.

public abstract int TryMatch(ReadOnlySpan<char> text, int index, PooledList<ParsedRange> results)

Attempts to match a pattern starting at the specified index.

public virtual void Finalize()

Called after parsing completes to finalize any pending ranges (e.g., unclosed tags).

public virtual void PostParse()

Called after tag stripping to add ranges in clean-text space.

public virtual void Reset()

Resets the rule state for a new parse operation.

See Also

TagParseRuleAttributeParser