Back to API Reference
Class
MarkdownWrapRule
sealed
Inherits:ParseRule
Parses symmetric open/close markers in text (e.g., **text**, ~~text~~).
Remarks
The marker string is configurable — any string can be used as a marker with any modifier. When DefaultParameter is set, matched ranges use it as the parameter value. Matching follows CommonMark §6.2 flanking rules (simplified to the marker occurrence's neighbours): a marker opens only when left-flanking (next char is not whitespace, and not punctuation unless preceded by whitespace/punctuation) and closes only when right-flanking (mirrored). Markers made of _ additionally never open or close inside a word, so snake_case_name stays literal. Stray markers in arithmetic (2 * 3) never open.
public override string Apply(ReadOnlySpan<char> content, string parameter)public override int TryMatch(ReadOnlySpan<char> text, int index, PooledList<ParsedRange> results)public override void Finalize(ReadOnlySpan<char> text, PooledList<ParsedRange> results)