Skip to main content

parse_inline_text_recursive

Function parse_inline_text_recursive 

Source
pub fn parse_inline_text_recursive(
    builder: &mut GreenNodeBuilder<'_>,
    text: &str,
    config: &ParserOptions,
)
Expand description

Parse inline text using the recursive emphasis algorithm.

This is the main entry point for parsing inline content with Pandoc-style recursive emphasis handling. It uses a greedy left-to-right, first-match-wins approach that matches Pandoc’s behavior exactly.

Algorithm:

  1. Parse text left-to-right trying each inline element type in precedence order
  2. When we see * or _, try to parse emphasis recursively
  3. Nested emphasis naturally consumes delimiters before outer matches
  4. All inline elements (code, links, math, etc.) are parsed on-the-fly

§Arguments

  • text - The inline text to parse
  • config - Configuration for extensions and formatting
  • builder - The CST builder to emit nodes to