Functions
get_marker_indent
1
int
▼
Extract indent level from list marker value.
Marker values are prefixed with s…
get_marker_indent
1
int
▼
def get_marker_indent(marker_value: str) -> int
Extract indent level from list marker value.
Marker values are prefixed with spaces by the lexer to encode indent. E.g., " -" has indent 2, "1." has indent 0.
Handles tabs by expanding them to the next multiple of 4 columns.
Parameters
| Name | Type | Description |
|---|---|---|
marker_value |
str |
The raw marker value from the token |
Returns
int
extract_marker_info
2
ListMarkerInfo
▼
Extract complete marker information from a marker token value.
extract_marker_info
2
ListMarkerInfo
▼
def extract_marker_info(marker_value: str, start_indent: int | None = None) -> ListMarkerInfo
Parameters
| Name | Type | Description |
|---|---|---|
marker_value |
str |
The raw marker value from the token |
start_indent |
int | None |
Override indent calculation (optional) Default:None
|
Returns
ListMarkerInfo
is_list_marker
1
bool
▼
Check if text starts with a list marker pattern.
is_list_marker
1
bool
▼
def is_list_marker(text: str) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Text to check (should be stripped of leading whitespace) |
Returns
bool
is_same_list_type
4
bool
▼
Check if a marker belongs to the same list type.
**CommonMark requires same li…
is_same_list_type
4
bool
▼
def is_same_list_type(marker_value: str, ordered: bool, bullet_char: str, ordered_marker_char: str) -> bool
Check if a marker belongs to the same list type.
CommonMark requires same list type and marker character:
- Unordered: -, *, + are different lists
- Ordered: . and ) are different lists
Parameters
| Name | Type | Description |
|---|---|---|
marker_value |
str |
The raw marker value from the token |
ordered |
bool |
Whether the current list is ordered |
bullet_char |
str |
Current list's bullet character (for unordered) |
ordered_marker_char |
str |
Current list's marker character (for ordered) |
Returns
bool
extract_task_marker
1
tuple[bool | None, str]
▼
Extract task list marker from line content.
extract_task_marker
1
tuple[bool | None, str]
▼
def extract_task_marker(line: str) -> tuple[bool | None, str]
Parameters
| Name | Type | Description |
|---|---|---|
line |
str |
The line content (stripped of marker) |
Returns
tuple[bool | None, str]