Classes
BaseNode
2
▼
Common fields for all AST nodes.
BaseNode
2
▼
Common fields for all AST nodes.
Attributes
| Name | Type | Description |
|---|---|---|
children |
list[ASTNode]
|
— |
attrs |
dict[str, str]
|
— |
TextNode
2
▼
Plain text content.
TextNode
2
▼
Plain text content.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['text']
|
— |
raw |
str
|
— |
CodeSpanNode
2
▼
Inline code.
CodeSpanNode
2
▼
Inline code.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['codespan']
|
— |
raw |
str
|
— |
HeadingNode
4
▼
Heading (h1-h6).
HeadingNode
4
▼
Heading (h1-h6).
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['heading']
|
— |
level |
int
|
— |
children |
list[ASTNode]
|
— |
attrs |
NotRequired[dict[str, str]]
|
— |
ParagraphNode
2
▼
Paragraph block.
ParagraphNode
2
▼
Paragraph block.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['paragraph']
|
— |
children |
list[ASTNode]
|
— |
CodeBlockNode
3
▼
Fenced code block.
CodeBlockNode
3
▼
Fenced code block.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['block_code']
|
— |
raw |
str
|
— |
info |
str | None
|
— |
ListNode
3
▼
Ordered or unordered list.
ListNode
3
▼
Ordered or unordered list.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['list']
|
— |
ordered |
bool
|
— |
children |
list[ListItemNode]
|
— |
ListItemNode
2
▼
List item.
ListItemNode
2
▼
List item.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['list_item']
|
— |
children |
list[ASTNode]
|
— |
BlockquoteNode
2
▼
Blockquote.
BlockquoteNode
2
▼
Blockquote.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['block_quote']
|
— |
children |
list[ASTNode]
|
— |
LinkNode
4
▼
Hyperlink.
LinkNode
4
▼
Hyperlink.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['link']
|
— |
url |
str
|
— |
title |
str | None
|
— |
children |
list[ASTNode]
|
— |
ImageNode
4
▼
Image.
ImageNode
4
▼
Image.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['image']
|
— |
src |
str
|
— |
alt |
str
|
— |
title |
str | None
|
— |
EmphasisNode
2
▼
Emphasis (italic).
EmphasisNode
2
▼
Emphasis (italic).
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['emphasis']
|
— |
children |
list[ASTNode]
|
— |
StrongNode
2
▼
Strong (bold).
StrongNode
2
▼
Strong (bold).
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['strong']
|
— |
children |
list[ASTNode]
|
— |
ThematicBreakNode
1
▼
Horizontal rule / thematic break.
ThematicBreakNode
1
▼
Horizontal rule / thematic break.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['thematic_break']
|
— |
SoftBreakNode
1
▼
Soft line break.
SoftBreakNode
1
▼
Soft line break.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['softbreak']
|
— |
HardBreakNode
1
▼
Hard line break.
HardBreakNode
1
▼
Hard line break.
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['linebreak']
|
— |
RawHTMLNode
2
▼
Pre-rendered HTML block.
Used for:
- Directive output (code blocks, admonitions, tabs)
- Virtual p…
RawHTMLNode
2
▼
Pre-rendered HTML block.
Used for:
- Directive output (code blocks, admonitions, tabs)
- Virtual page content (page._prerendered_html)
- External embeds
- Any content that bypasses markdown parsing
Attributes
| Name | Type | Description |
|---|---|---|
type |
Literal['raw_html']
|
— |
content |
str
|
— |
Functions
is_heading
1
bool
▼
Type guard for heading nodes.
is_heading
1
bool
▼
def is_heading(node: ASTNode) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
bool
is_text
1
bool
▼
Type guard for text nodes.
is_text
1
bool
▼
def is_text(node: ASTNode) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
bool
is_code_block
1
bool
▼
Type guard for code block nodes.
is_code_block
1
bool
▼
def is_code_block(node: ASTNode) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
bool
is_link
1
bool
▼
Type guard for link nodes.
is_link
1
bool
▼
def is_link(node: ASTNode) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
bool
is_image
1
bool
▼
Type guard for image nodes.
is_image
1
bool
▼
def is_image(node: ASTNode) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
bool
is_raw_html
1
bool
▼
Type guard for raw HTML nodes.
is_raw_html
1
bool
▼
def is_raw_html(node: ASTNode) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
bool
get_heading_level
1
int | None
▼
Get heading level if node is a heading.
get_heading_level
1
int | None
▼
def get_heading_level(node: ASTNode) -> int | None
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
int | None
get_node_text
1
str
▼
Extract text content from a node.
get_node_text
1
str
▼
def get_node_text(node: ASTNode) -> str
Parameters
| Name | Type | Description |
|---|---|---|
node |
ASTNode |
Returns
str