node¶
Node¶
- class cmarkwrapper.node.Node(node)¶
- 返回类型
None
- append_child(child)¶
Append child to children of node.
- 返回
Trueon success,Falseon failure.- 参数
child (cmarkwrapper.node.Node) --
- 返回类型
bool
- first_child()¶
Return first child of node, if available.
- 返回
A node or None.
- 返回类型
Optional[cmarkwrapper.node.Node]
- free()¶
Free memory for node and its children (if any).
- get_end_column()¶
Return column at which node ends.
- 返回
Column number (starts from
1).- 返回类型
int
- get_end_line()¶
Return line on which node ends.
- 返回
Line number (starts from
1).- 返回类型
int
- get_fence_info()¶
Return fence info from fenced code block.
For nodes having type other than
NODE_CODE_BLOCKreturns None.- 返回类型
Optional[str]
- get_heading_level()¶
Return level of heading.
- 返回
[1, 6]for headings,0for non-heading nodes.- 返回类型
int
- get_list_delim()¶
Return type of list delimiter.
- 返回
One of Delimiter.
- 返回类型
- get_list_start()¶
Return starting number of list. :return: Starting number of an ordered list or
0.- 返回类型
int
- get_list_tight()¶
Return 1 if node is a tight list.
- 返回
1if node is a tight list,0otherwise.- 返回类型
int
- get_list_type()¶
Return list type of node.
- 返回
One of ListType.
- 返回类型
- get_literal()¶
Return string contents of node.
Returns None for nodes having type other than
NODE_HTML_BLOCK,NODE_TEXT,NODE_HTML_INLINE,NODE_CODEorNODE_CODE_BLOCK.- 返回类型
Optional[str]
- get_start_column()¶
Return column at which node begins.
- 返回
Column number (starts from
1).- 返回类型
int
- get_start_line()¶
Return line on which node begins. :return: Line number (starts from
1).- 返回类型
int
- get_title()¶
Return title of image or link, or None.
- 返回类型
Optional[str]
- get_type()¶
Return type of node.
- 返回
One of NodeType.
- 返回类型
- get_type_string()¶
Return type of node as string.
- 返回类型
str
- get_url()¶
Return URL of image or link, or None.
- 返回类型
Optional[str]
- insert_after(sibling)¶
Insert sibling after node.
- 返回
Trueon success,Falseon failure.- 参数
sibling (cmarkwrapper.node.Node) --
- 返回类型
bool
- insert_before(sibling)¶
Insert sibling before node.
- 返回
Trueon success,Falseon failure.- 参数
sibling (cmarkwrapper.node.Node) --
- 返回类型
bool
- last_child()¶
Return last child of node, if available.
- 返回
A node or None.
- 返回类型
Optional[cmarkwrapper.node.Node]
- next()¶
Return next node, if available.
- 返回
A node or None.
- 返回类型
Optional[cmarkwrapper.node.Node]
- parent()¶
Return a parent of node, if available.
- 返回
A node or None.
- 返回类型
Optional[cmarkwrapper.node.Node]
- prepend_child(child)¶
Prepend child to children of node.
- 返回
Trueon success,Falseon failure.- 参数
child (cmarkwrapper.node.Node) --
- 返回类型
bool
- previous()¶
Return previous node, if available.
- 返回
A node or None.
- 返回类型
Optional[cmarkwrapper.node.Node]
- set_fence_info(info)¶
Set fence info of fenced code block.
- 参数
info (str) -- Fence info.
- 返回
Trueon success,Falseon failure.- 返回类型
bool
- set_heading_level(level)¶
Set level of heading.
- 参数
level (int) --
[1, 6]- 返回
Trueon success,Falseon failure.
- set_list_delim(list_delim)¶
Set the type of list delimiter for node.
- 参数
list_delim (cmarkwrapper.types.Delimiter) -- One of Delimiter.
- 返回
Trueon success,Falseon failure.
- set_list_start(start)¶
Set starting number of ordered list.
- 参数
start (int) -- Starting number.
- 返回
Trueon success,Falseon failure.- 返回类型
bool
- set_list_tight(tight)¶
Set tightness of list.
- 参数
tight (int) --
1for tight,0for loose.- 返回
1on success,0on failure.
- set_list_type(list_type)¶
Set the list type of node.
- 参数
list_type (cmarkwrapper.types.ListType) -- One of ListType.
- 返回
Trueon success,Falseon failure.- 返回类型
bool
- set_literal(contents)¶
Set string contents of node.
- 参数
contents (str) -- New contents of node.
- 返回
Trueon success,Falseon failure.- 返回类型
bool
- set_title(title)¶
Set title of image or link.
- 参数
title (str) -- New title.
- 返回
Trueon success,Falseon failure.- 返回类型
bool
- set_url(url)¶
Set URL of image or link.
- 参数
url (str) -- New URL.
- 返回
Trueon success,Falseon failure.- 返回类型
bool