Skip to main content

parse_text

Function parse_text 

Source
pub fn parse_text(input: GrammarSpan<'_>) -> IResult<GrammarSpan<'_>, Node>
Expand description

Parse plain text up to the next special character

Consumes text until a special inline character is found (*_`[<!&\n).

Note: This also stops at several extension delimiters so they can be parsed in the middle of a line:

  • ^ (superscript)
  • ~ (subscript or strikethrough)
  • == (mark)
  • -- (dash strikethrough)
  • ˅ (arrow-style subscript) Handles special cases:
  • Trailing spaces before newlines (potential hard line break)
  • Consecutive backticks (consume all together)

§Arguments

  • input - The input text as a GrammarSpan

§Returns

  • Ok((remaining, node)) - Successfully parsed text node
  • Err(_) - No text to parse (input starts with special character)