Module

parsing.blocks.quote_fast_path

Fast path for simple block quote parsing.

Bypasses the complex recursive sub-parser overhead for simple block quotes.

Simple block quote criteria (all must be true):

  1. No nested block quotes (>>)
  2. No lazy continuation (every line starts with>)
  3. Content is simple paragraphs (no lists, code blocks, headings, etc.)
  4. No blank lines within the quote (single paragraph)

Performance: ~3-5% improvement for block quote-heavy documents.

Functions

is_simple_block_quote 2 bool
Check if the block quote starting at start_pos meets simple criteria.
def is_simple_block_quote(tokens: list, start_pos: int) -> bool
Parameters
Name Type Description
tokens list

Full token list

start_pos int

Position of first BLOCK_QUOTE_MARKER token

Returns
bool
parse_simple_block_quote 3 tuple[BlockQuote, int]
Parse a simple block quote using the fast path.
def parse_simple_block_quote(tokens: list, start_pos: int, parse_inline_fn) -> tuple[BlockQuote, int]
Parameters
Name Type Description
tokens list

Full token list

start_pos int

Position of first BLOCK_QUOTE_MARKER token

parse_inline_fn

Function to parse inline content: (text, location) -> tuple[Inline, ...]

Returns
tuple[BlockQuote, int]