Module

parsing.blocks.list.blank_line

Blank line handling for list parsing.

Handles the complex logic for blank lines within and between list items.

Phase 4: Uses ContainerStack for indent queries (stack is source of truth).

Classes

BlankLineResult 0
Base class for blank line handling results.

Base class for blank line handling results.

ContinueList 1
Continue parsing the current list (may mark as loose).

Continue parsing the current list (may mark as loose).

Methods

Internal Methods 1
__init__ 2
def __init__(self, is_loose: bool = False, save_paragraph: bool = False)
Parameters
Name Type Description
is_loose Default:False
save_paragraph Default:False
EndItem 1
End the current list item but continue the list.

End the current list item but continue the list.

Methods

Internal Methods 1
__init__ 1
def __init__(self, is_loose: bool = True)
Parameters
Name Type Description
is_loose Default:True
EndList 0
End the entire list.

End the entire list.

ParseBlock 1
Parse the next token as a block element within the list item.

Parse the next token as a block element within the list item.

Methods

Internal Methods 1
__init__ 1
def __init__(self, is_loose: bool = True)
Parameters
Name Type Description
is_loose Default:True
ParseContinuation 1
Parse the next token as continuation content.

Parse the next token as continuation content.

Methods

Internal Methods 1
__init__ 2
def __init__(self, is_loose: bool = True, save_paragraph: bool = True)
Parameters
Name Type Description
is_loose Default:True
save_paragraph Default:True

Functions

handle_blank_line 2 BlankLineResult
Handle blank line in list parsing using ContainerStack. Determines what action…
def handle_blank_line(next_token: Token | None, containers: ContainerStack) -> BlankLineResult

Handle blank line in list parsing using ContainerStack.

Determines what action to take after encountering a blank line within a list item. Queries indent values from the container stack (the stack is the source of truth for indent context).

Parameters
Name Type Description
next_token Token | None

The token following the blank line(s)

containers ContainerStack

The container stack with current frame context

Returns
BlankLineResult
_handle_blank_then_indented_code 2 BlankLineResult
Handle INDENTED_CODE token after blank line using ContainerStack. This is comp…
def _handle_blank_then_indented_code(token: Token, containers: ContainerStack) -> BlankLineResult

Handle INDENTED_CODE token after blank line using ContainerStack.

This is complex because INDENTED_CODE may be:

  • A list marker continuation (at list level)
  • Paragraph continuation (at content level)
  • Block quote or fenced code
  • Actual indented code block (4+ beyond content)
Parameters
Name Type Description
token Token

The INDENTED_CODE token

containers ContainerStack

The container stack with current frame context

Returns
BlankLineResult