Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
markdown_it.tree.SyntaxTreeNode Class Reference

Public Member Functions

None __init__ (self, Sequence[Token] tokens=(), *bool create_root=True)
 
str __repr__ (self)
 
_NodeType __getitem__ (_NodeType self, int item)
 
list[_NodeType] __getitem__ (_NodeType self, slice item)
 
_NodeType|list[_NodeType] __getitem__ (_NodeType self, int|slice item)
 
list[Tokento_tokens (_NodeType self)
 
list[_NodeType] children (_NodeType self)
 
None children (_NodeType self, list[_NodeType] value)
 
_NodeType|None parent (_NodeType self)
 
None parent (_NodeType self, _NodeType|None value)
 
bool is_root (self)
 
bool is_nested (self)
 
Sequence[_NodeType] siblings (_NodeType self)
 
str type (self)
 
_NodeType|None next_sibling (_NodeType self)
 
_NodeType|None previous_sibling (_NodeType self)
 
str pretty (self, *int indent=2, bool show_text=False, int _current=0)
 
Generator[_NodeType, None, None] walk (_NodeType self, *bool include_self=True)
 
str tag (self)
 
dict[str, str|int|float] attrs (self)
 
None|str|int|float attrGet (self, str name)
 
tuple[int, int]|None map (self)
 
int level (self)
 
str content (self)
 
str markup (self)
 
str info (self)
 
dict[Any, Any] meta (self)
 
bool block (self)
 
bool hidden (self)
 

Public Attributes

 token
 
 nester_tokens
 
 siblings
 

Protected Member Functions

None _add_child (self, Sequence[Token] tokens)
 
None _set_children_from_tokens (self, Sequence[Token] tokens)
 
Token _attribute_token (self)
 

Protected Attributes

 _children
 
 _parent
 

Detailed Description

A Markdown syntax tree node.

A class that can be used to construct a tree representation of a linear
`markdown-it-py` token stream.

Each node in the tree represents either:
  - root of the Markdown document
  - a single unnested `Token`
  - a `Token` "_open" and "_close" token pair, and the tokens nested in
      between

Constructor & Destructor Documentation

◆ __init__()

None markdown_it.tree.SyntaxTreeNode.__init__ (   self,
Sequence[Token]   tokens = (),
*bool   create_root = True 
)
Initialize a `SyntaxTreeNode` from a token stream.

If `create_root` is True, create a root node for the document.

Member Function Documentation

◆ _add_child()

None markdown_it.tree.SyntaxTreeNode._add_child (   self,
Sequence[Token tokens 
)
protected
Make a child node for `self`.

◆ _attribute_token()

Token markdown_it.tree.SyntaxTreeNode._attribute_token (   self)
protected
Return the `Token` that is used as the data source for the
properties defined below.

◆ _set_children_from_tokens()

None markdown_it.tree.SyntaxTreeNode._set_children_from_tokens (   self,
Sequence[Token tokens 
)
protected
Convert the token stream to a tree structure and set the resulting
nodes as children of `self`.

◆ attrGet()

None | str | int | float markdown_it.tree.SyntaxTreeNode.attrGet (   self,
str  name 
)
Get the value of attribute `name`, or null if it does not exist.

◆ attrs()

dict[str, str | int | float] markdown_it.tree.SyntaxTreeNode.attrs (   self)
Html attributes.

◆ block()

bool markdown_it.tree.SyntaxTreeNode.block (   self)
True for block-level tokens, false for inline tokens.

◆ content()

str markdown_it.tree.SyntaxTreeNode.content (   self)
In a case of self-closing tag (code, html, fence, etc.), it
has contents of this tag.

◆ hidden()

bool markdown_it.tree.SyntaxTreeNode.hidden (   self)
If it's true, ignore this element when rendering.
Used for tight lists to hide paragraphs.

◆ info()

str markdown_it.tree.SyntaxTreeNode.info (   self)
fence infostring

◆ is_nested()

bool markdown_it.tree.SyntaxTreeNode.is_nested (   self)
Is this node nested?.

Returns `True` if the node represents a `Token` pair and tokens in the
sequence between them, where `Token.nesting` of the first `Token` in
the pair is 1 and nesting of the other `Token` is -1.

◆ is_root()

bool markdown_it.tree.SyntaxTreeNode.is_root (   self)
Is the node a special root node?

◆ level()

int markdown_it.tree.SyntaxTreeNode.level (   self)
nesting level, the same as `state.level`

◆ map()

tuple[int, int] | None markdown_it.tree.SyntaxTreeNode.map (   self)
Source map info. Format: `tuple[ line_begin, line_end ]`

◆ markup()

str markdown_it.tree.SyntaxTreeNode.markup (   self)
'*' or '_' for emphasis, fence string for fence, etc.

◆ meta()

dict[Any, Any] markdown_it.tree.SyntaxTreeNode.meta (   self)
A place for plugins to store an arbitrary data.

◆ next_sibling()

_NodeType | None markdown_it.tree.SyntaxTreeNode.next_sibling ( _NodeType  self)
Get the next node in the sequence of siblings.

Returns `None` if this is the last sibling.

◆ pretty()

str markdown_it.tree.SyntaxTreeNode.pretty (   self,
*int   indent = 2,
bool   show_text = False,
int   _current = 0 
)
Create an XML style string of the tree.

◆ previous_sibling()

_NodeType | None markdown_it.tree.SyntaxTreeNode.previous_sibling ( _NodeType  self)
Get the previous node in the sequence of siblings.

Returns `None` if this is the first sibling.

◆ siblings()

Sequence[_NodeType] markdown_it.tree.SyntaxTreeNode.siblings ( _NodeType  self)
Get siblings of the node.

Gets the whole group of siblings, including self.

◆ tag()

str markdown_it.tree.SyntaxTreeNode.tag (   self)
html tag name, e.g. \"p\" 

◆ to_tokens()

list[Token] markdown_it.tree.SyntaxTreeNode.to_tokens ( _NodeType  self)
Recover the linear token stream.

◆ type()

str markdown_it.tree.SyntaxTreeNode.type (   self)
Get a string type of the represented syntax.

- "root" for root nodes
- `Token.type` if the node represents an unnested token
- `Token.type` of the opening token, with "_open" suffix stripped, if
    the node represents a nester token pair

◆ walk()

Generator[_NodeType, None, None] markdown_it.tree.SyntaxTreeNode.walk ( _NodeType  self,
*bool   include_self = True 
)
Recursively yield all descendant nodes in the tree starting at self.

The order mimics the order of the underlying linear token
stream (i.e. depth first).

The documentation for this class was generated from the following file: