module documentation

Built-in block-level token classes.

Class BlockCode Indented code block token. This is a leaf block token with a single child of type span_token.RawText.
Class BlockToken Base class for block-level tokens. Recursively parse inner tokens.
Class CodeFence Fenced code block token. (["`sh\n", "rm -rf /", ..., "`"]) This is a leaf block token with a single child of type span_token.RawText.
Class Document Document token. This is a container block token. Its children are block tokens - container or leaf ones.
Class Footnote Footnote token. A "link reference definition" according to the spec. This is a leaf block token. Its children are inline (span) tokens.
Class Heading ATX heading token. (["### some heading ###n"]) This is a leaf block token. Its children are inline (span) tokens.
Class HTMLBlock Block-level HTML token. This is a leaf block token without children.
Class List List token. This is a container block token. Its children are list item tokens.
Class ListItem List item token. This is a container block token. Its children are block tokens - container or leaf ones.
Class Paragraph Paragraph token. (["somen", "continuousn", "linesn"]) This is a leaf block token. Its children are inline (span) tokens.
Class Quote Block quote token. (["> # headingn", "> paragraphn"]) This is a container block token. Its children are block tokens - container or leaf ones.
Class SetextHeading Setext heading token. This is a leaf block token. Its children are inline (span) tokens.
Class Table Table token. This is a container block token. Its children are table row tokens.
Class TableCell Table cell token. This is a leaf block token. Its children are inline (span) tokens.
Class TableRow Table row token. Supports escaped pipes in table cells (for primary use within code spans). This is a container block token. Its children are table cell tokens.
Class ThematicBreak Thematic break token (a.k.a. horizontal rule.) This is a leaf block token without children.
Function add_token Allows external manipulation of the parsing process. This function is usually called in BaseRenderer.__enter__.
Function remove_token Allows external manipulation of the parsing process. This function is usually called in BaseRenderer.__exit__.
Function reset_tokens Resets global _token_types to all token classes in __all__.
Function tokenize A wrapper around block_tokenizer.tokenize. Pass in all block-level token constructors as arguments to block_tokenizer.tokenize.
Variable _token_types Undocumented
def add_token(token_cls, position=0): (source)

Allows external manipulation of the parsing process. This function is usually called in BaseRenderer.__enter__.

Parameters
token_cls:SpanTokentoken to be included in the parsing process.
position:intthe position for the token class to be inserted into.
def remove_token(token_cls): (source)

Allows external manipulation of the parsing process. This function is usually called in BaseRenderer.__exit__.

Parameters
token_cls:BlockTokentoken to be removed from the parsing process.
def reset_tokens(): (source)

Resets global _token_types to all token classes in __all__.

def tokenize(lines): (source)

A wrapper around block_tokenizer.tokenize. Pass in all block-level token constructors as arguments to block_tokenizer.tokenize.

Doing so (instead of importing block_token module in block_tokenizer) avoids cyclic dependency issues, and allows for future injections of custom token classes.

_token_types variable is at the bottom of this module.

See also: block_tokenizer.tokenize, span_token.tokenize_inner.

_token_types: list = (source)

Undocumented