Skip to main content

parse_markdown_formatting

Function parse_markdown_formatting 

Source
pub fn parse_markdown_formatting(text: &str) -> Option<ParsedFormatting>
Expand description

Parse markdown emphasis markers from message text and return cleaned text plus formatting ranges. Returns None if text is unchanged.

Algorithm (4 phases):

  1. Protect code blocks, inline code, URLs with PUA character runs
  2. Process backslash escapes
  3. Sequential emphasis passes (longest markers first), adjusting offsets
  4. Restore protected regions and escaped characters