MathParseRule
Replaces a formula with one layout placeholder while preserving its source as the modifier parameter: from <math>...</math> tags or LaTeX math delimiters, as Delimiters selects.
Remarks
public MathDelimiters Delimiters{ get; set }Gets or sets the syntax formulas are read from.
The source-markup token this rule's syntax is externally known by — whatever form the syntax takes (color for a tag rule, a marker for a marker rule) — or null for a markerless rule. Interop consumers (clipboard bindings) pair rules with format schemas by this token instead of testing syntax families.
Stable identity shared by rule instances that match the same syntax, compared case-insensitively — pairs separately configured instances (style merging, ByRule chrome selectors). The default (full type name) is correct for configuration-free rules. A rule whose instances can be configured to match different syntaxes MUST qualify it (TagRule → "tag:" + name, marker rule → "marker:" + marker) or return null (identity by reference only) — otherwise differently configured instances are falsely treated as the same rule. Called on hot paths — cache the string, don't rebuild it per access.
Characters of which at least one must start any match of this rule that alters the visible text — strips markup (tags, markers), replaces it, or inserts content. Empty = the rule never consumes text (style-only matches like raw-URL detection); null (default) = unknown, callers must assume any text can be consumed. Literal-paste escaping protects exactly these characters, so under-reporting silently mutates pasted text.
Characters whose insertion or removal can make this rule begin or complete a consuming markup match. The editable document parses typed syntax only when an edit contains one of these characters or touches its immediate boundary; empty means this rule has no source syntax, while null conservatively parses every direct typing edit. Include closing delimiters and required separators, not only match starts.
public override int TryMatch(ReadOnlySpan<char> text, int index, PooledList<ParsedRange> results)Attempts to match a pattern starting at the specified index.
public override string Apply(ReadOnlySpan<char> content, string parameter)Emits this rule's source syntax wrapping content — the inverse of parsing, used by the editing layer to apply a style and to reconstruct copied markup. Returns null when the rule has no content-wrapping form (void, block, or composite rules), meaning it cannot be applied as an inline style.
