rich.markdown¶
- class rich.markdown.BlockQuote[source]¶
A block quote.
- on_child_close(context, child)[source]¶
Called when a child element is closed.
This method allows a parent element to take over rendering of its children.
- Parameters
context (MarkdownContext) – The markdown context.
child (MarkdownElement) – The child markdown element.
- Returns
Return True to render the element, or False to not render the element.
- Return type
- class rich.markdown.Heading(tag)[source]¶
A heading.
- Parameters
tag (str) –
- classmethod create(markdown, token)[source]¶
Factory to create markdown element,
- Parameters
markdown (Markdown) – The parent Markdown object.
token (Token) – A node from markdown-it.
- Returns
A new markdown element
- Return type
MarkdownElement
- on_enter(context)[source]¶
Called when the node is entered.
- Parameters
context (MarkdownContext) – The markdown context.
- Return type
None
- class rich.markdown.ImageItem(destination, hyperlinks)[source]¶
Renders a placeholder for an image.
- classmethod create(markdown, token)[source]¶
Factory to create markdown element,
- Parameters
markdown (Markdown) – The parent Markdown object.
token (Any) – A token from markdown-it.
- Returns
A new markdown element
- Return type
MarkdownElement
- on_enter(context)[source]¶
Called when the node is entered.
- Parameters
context (MarkdownContext) – The markdown context.
- Return type
None
- class rich.markdown.ListElement(list_type, list_start)[source]¶
A list element.
- classmethod create(markdown, token)[source]¶
Factory to create markdown element,
- Parameters
markdown (Markdown) – The parent Markdown object.
token (Token) – A node from markdown-it.
- Returns
A new markdown element
- Return type
MarkdownElement
- on_child_close(context, child)[source]¶
Called when a child element is closed.
This method allows a parent element to take over rendering of its children.
- Parameters
context (MarkdownContext) – The markdown context.
child (MarkdownElement) – The child markdown element.
- Returns
Return True to render the element, or False to not render the element.
- Return type
- class rich.markdown.ListItem[source]¶
An item in a list.
- on_child_close(context, child)[source]¶
Called when a child element is closed.
This method allows a parent element to take over rendering of its children.
- Parameters
context (MarkdownContext) – The markdown context.
child (MarkdownElement) – The child markdown element.
- Returns
Return True to render the element, or False to not render the element.
- Return type
- class rich.markdown.Markdown(markup, code_theme='monokai', justify=None, style='none', hyperlinks=True, inline_code_lexer=None, inline_code_theme=None)[source]¶
A Markdown renderable.
- Parameters
markup (str) – A string containing markdown.
code_theme (str, optional) – Pygments theme for code blocks. Defaults to “monokai”.
justify (JustifyMethod, optional) – Justify value for paragraphs. Defaults to None.
style (Union[str, Style], optional) – Optional style to apply to markdown.
hyperlinks (bool, optional) – Enable hyperlinks. Defaults to
True
.inline_code_lexer (Optional[str]) – (str, optional): Lexer to use if inline code highlighting is enabled. Defaults to None.
inline_code_theme (Optional[str]) – (Optional[str], optional): Pygments theme for inline code highlighting, or None for no highlighting. Defaults to None.
- class rich.markdown.MarkdownContext(console, options, style, inline_code_lexer=None, inline_code_theme='monokai')[source]¶
Manages the console render state.
- Parameters
console (Console) –
options (ConsoleOptions) –
style (Style) –
inline_code_lexer (Optional[str]) –
inline_code_theme (str) –
- class rich.markdown.Paragraph(justify)[source]¶
A Paragraph.
- Parameters
justify (typing_extensions.Literal[default, left, center, right, full]) –
- class rich.markdown.TextElement[source]¶
Base class for elements that render text.
- on_enter(context)[source]¶
Called when the node is entered.
- Parameters
context (MarkdownContext) – The markdown context.
- Return type
None
- on_leave(context)[source]¶
Called when the parser leaves the element.
- Parameters
context (MarkdownContext) – [description]
- Return type
None