Module

parsing.blocks.list.indent

Indent calculation utilities for list parsing.

Provides functions for calculating and managing indentation levels.

Functions

calculate_content_indent 4 int
Calculate the content indent for a list item. CommonMark: The content indent i…
def calculate_content_indent(source: str, marker_stripped: str, marker_indent: int, line_offset: int) -> int

Calculate the content indent for a list item.

CommonMark: The content indent is the column position of the first non-space character after the marker. If the line is empty after the marker, it's marker_end_col + 1.

Parameters
Name Type Description
source str

The full source text

marker_stripped str

The marker with leading whitespace stripped

marker_indent int

The indent level of the marker

line_offset int

The offset in source where this token starts

Returns
int
is_continuation_indent 3 bool
Check if a line's indent qualifies as continuation content. CommonMark: Conten…
def is_continuation_indent(line_indent: int, content_indent: int, start_indent: int) -> bool

Check if a line's indent qualifies as continuation content.

CommonMark: Content indented at least as much as the list item's content indentation is continuation content.

Parameters
Name Type Description
line_indent int

The indent of the line in question

content_indent int

The content indent of the current list item

start_indent int

The indent of the list's first marker

Returns
bool
is_nested_list_indent 2 bool
Check if a line's indent qualifies for starting a nested list. CommonMark: A l…
def is_nested_list_indent(line_indent: int, content_indent: int) -> bool

Check if a line's indent qualifies for starting a nested list.

CommonMark: A list marker at content_indent or deeper can be a nested list.

Parameters
Name Type Description
line_indent int

The indent of the line in question

content_indent int

The content indent of the current list item

Returns
bool
is_indented_code_indent 2 bool
Check if a line's indent qualifies as indented code. CommonMark: Content inden…
def is_indented_code_indent(line_indent: int, content_indent: int) -> bool

Check if a line's indent qualifies as indented code.

CommonMark: Content indented 4+ spaces beyond content_indent is indented code block.

Parameters
Name Type Description
line_indent int

The indent of the line in question

content_indent int

The content indent of the current list item

Returns
bool