Classes
HeadingClassifierMixin
2
▼
Mixin providing ATX heading classification.
HeadingClassifierMixin
2
▼
Mixin providing ATX heading classification.
Methods
Internal Methods 2 ▼
_location_from
3
SourceLocation
▼
Get source location from saved position. Implemented by Lexer.
_location_from
3
SourceLocation
▼
def _location_from(self, start_pos: int, start_col: int | None = None, end_pos: int | None = None) -> SourceLocation
Parameters
| Name | Type | Description |
|---|---|---|
start_pos |
— |
|
start_col |
— |
Default:None
|
end_pos |
— |
Default:None
|
Returns
SourceLocation
_try_classify_atx_heading
3
Token | None
▼
Try to classify content as ATX heading.
ATX headings start with 1-6 # characte…
_try_classify_atx_heading
3
Token | None
▼
def _try_classify_atx_heading(self, content: str, line_start: int, indent: int = 0) -> Token | None
Try to classify content as ATX heading.
ATX headings start with 1-6 # characters followed by space/tab/newline/end. Trailing # sequences are removed if preceded by space.
Parameters
| Name | Type | Description |
|---|---|---|
content |
— |
Line content with leading whitespace stripped |
line_start |
— |
Position in source where line starts |
indent |
— |
Number of leading spaces (for line_indent) Default:0
|
Returns
Token | None
Token if valid heading, None otherwise.