Module

parsing.blocks.list.item_blocks

Block element handling within list items.

Handles parsing of block elements (thematic breaks, fenced code, block quotes, indented code) that appear within list items.

Classes

ParserProtocol 1
Protocol for parser methods needed by block handlers.

Protocol for parser methods needed by block handlers.

Attributes

Name Type Description
_source str

Functions

handle_thematic_break 4 tuple[Block | None, bool]
Handle a thematic break token within a list item.
def handle_thematic_break(token: Token, saw_paragraph_content: bool, has_content_lines: bool, parser: ParserProtocol) -> tuple[Block | None, bool]
Parameters
Name Type Description
token Token

The THEMATIC_BREAK token

saw_paragraph_content bool

Whether paragraph content was seen before this

has_content_lines bool

Whether there are accumulated content lines

parser ParserProtocol

The parser instance

Returns
tuple[Block | None, bool]
handle_fenced_code_immediate 5 tuple[Block | None, bool]
Handle a fenced code block immediately after list marker.
def handle_fenced_code_immediate(token: Token, saw_paragraph_content: bool, has_content_lines: bool, content_indent: int, parser: ParserProtocol) -> tuple[Block | None, bool]
Parameters
Name Type Description
token Token

The FENCED_CODE_START token

saw_paragraph_content bool

Whether paragraph content was seen before this

has_content_lines bool

Whether there are accumulated content lines

content_indent int

Content indent for the list item

parser ParserProtocol

The parser instance

Returns
tuple[Block | None, bool]
parse_block_quote_from_indented_code 3 BlockQuote
Parse a block quote from INDENTED_CODE tokens. Used when block quote markers a…
def parse_block_quote_from_indented_code(start_token: Token, parser: ParserProtocol, check_indent: int) -> BlockQuote

Parse a block quote from INDENTED_CODE tokens.

Used when block quote markers appear at content indent level within list items, where the lexer produces INDENTED_CODE tokens.

Parameters
Name Type Description
start_token Token

The first INDENTED_CODE token with block quote content

parser ParserProtocol

The parser instance

check_indent int

The content indent level

Returns
BlockQuote
parse_fenced_code_from_indented_code 3 FencedCode
Parse a fenced code block from INDENTED_CODE tokens. Used when fenced code app…
def parse_fenced_code_from_indented_code(start_token: Token, parser: ParserProtocol, check_indent: int) -> FencedCode

Parse a fenced code block from INDENTED_CODE tokens.

Used when fenced code appears at content indent level within list items.

Parameters
Name Type Description
start_token Token

The first INDENTED_CODE token with fence markers

parser ParserProtocol

The parser instance

check_indent int

The content indent level

Returns
FencedCode
parse_indented_code_in_list 3 IndentedCode
Parse an indented code block within a list item.
def parse_indented_code_in_list(start_token: Token, parser: ParserProtocol, check_indent: int) -> IndentedCode
Parameters
Name Type Description
start_token Token

The first INDENTED_CODE token

parser ParserProtocol

The parser instance

check_indent int

The content indent level

Returns
IndentedCode