Classes
ParserProtocol
1
▼
Protocol for parser methods needed by nested list handlers.
ParserProtocol
1
▼
Protocol for parser methods needed by nested list handlers.
Attributes
| Name | Type | Description |
|---|---|---|
_source |
str
|
— |
Functions
detect_nested_block_in_content
3
bool
▼
Detect if paragraph line content is actually a nested block marker.
CommonMark…
detect_nested_block_in_content
3
bool
▼
def detect_nested_block_in_content(line: str, line_indent: int, content_indent: int) -> bool
Detect if paragraph line content is actually a nested block marker.
CommonMark: If the first content after a list marker is itself a block marker (list, blockquote, heading, etc.), it should be parsed as a nested block, BUT only if it's indented appropriately (not 4+ spaces beyond content indent).
Parameters
| Name | Type | Description |
|---|---|---|
line |
str |
The stripped line content |
line_indent |
int |
Indent of the line (from tok.line_indent) |
content_indent |
int |
Content indent of the current list item |
Returns
bool
parse_nested_list_inline
8
list[Block]
▼
Parse a nested list from inline content.
Used when a paragraph line turns out …
parse_nested_list_inline
8
list[Block]
▼
def parse_nested_list_inline(line: str, token_location: object, parser: ParserProtocol, directive_registry: object | None, strict_contracts: bool, tables_enabled: bool, strikethrough_enabled: bool, task_lists_enabled: bool) -> list[Block]
Parse a nested list from inline content.
Used when a paragraph line turns out to be a nested list marker.
Parameters
| Name | Type | Description |
|---|---|---|
line |
str |
The content line that is a list marker |
token_location |
object |
Location of the token |
parser |
ParserProtocol |
The parser instance |
directive_registry |
object | None |
Registry for directives |
strict_contracts |
bool |
Whether to enforce strict contracts |
tables_enabled |
bool |
Whether tables are enabled |
strikethrough_enabled |
bool |
Whether strikethrough is enabled |
task_lists_enabled |
bool |
Whether task lists are enabled |
Returns
list[Block]
parse_nested_list_from_indented_code
4
List | None
▼
Parse a nested list from an INDENTED_CODE token containing a list marker.
When…
parse_nested_list_from_indented_code
4
List | None
▼
def parse_nested_list_from_indented_code(token: Token, original_indent: int, parent_content_indent: int, parser: ParserProtocol) -> List | None
Parse a nested list from an INDENTED_CODE token containing a list marker.
When the lexer produces INDENTED_CODE for 4+ space indented lines, those lines may actually be nested list markers in list context.
Parameters
| Name | Type | Description |
|---|---|---|
token |
Token |
The INDENTED_CODE token containing the list marker |
original_indent |
int |
The original indentation of the line in source |
parent_content_indent |
int |
The content indent of the parent list item |
parser |
ParserProtocol |
The parser instance |
Returns
List | None
_is_sibling_marker
5
bool
▼
Check if content is a sibling list marker at the expected indent.
_is_sibling_marker
5
bool
▼
def _is_sibling_marker(content: str, content_indent: int, expected_indent: int, ordered: bool, marker_char: str) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
content |
str |
|
content_indent |
int |
|
expected_indent |
int |
|
ordered |
bool |
|
marker_char |
str |
Returns
bool
_extract_remaining_content
2
str
▼
Extract content after the list marker.
_extract_remaining_content
2
str
▼
def _extract_remaining_content(content: str, ordered: bool) -> str
Parameters
| Name | Type | Description |
|---|---|---|
content |
str |
|
ordered |
bool |
Returns
str