Class Renderer

Inheritance Relationships

Base Type

  • public object

Class Documentation

class Renderer

The default HTML renderer for rendering Markdown.

Public Functions

__init__(self self, kwargs kwargs)
placeholder(self self)

Returns the default, empty output value for the renderer.

All renderer methods use the '+=' operator to append to this value.
Default is a string so rendering HTML can build up a result string with
the rendered Markdown.

Can be overridden by Renderer subclasses to be types like an empty
list, allowing the renderer to create a tree-like structure to
represent the document (which can then be reprocessed later into a
separate format like docx or pdf).

block_code(self self, code code, lang lang = None)

Rendering block level code. ``pre > code``.

:param code: text content of the code block.
:param lang: language of the given code.

block_quote(self self, text text)

Rendering <blockquote> with the given text.

:param text: text content of the blockquote.

block_html(self self, html html)

Rendering block level pure html content.

:param html: text content of the html snippet.

header(self self, text text, level level, raw raw = None)

Rendering header/heading tags like ``<h1>`` ``<h2>``.

:param text: rendered text content for the header.
:param level: a number for the header level, for example: 1.
:param raw: raw text content of the header.

hrule(self self)

Rendering method for ``<hr>`` tag.

list(self self, body body, ordered ordered = True)

Rendering list tags like ``<ul>`` and ``<ol>``.

:param body: body contents of the list.
:param ordered: whether this list is ordered or not.

list_item(self self, text text)

Rendering list item snippet. Like ``<li>``.

paragraph(self self, text text)

Rendering paragraph tags. Like ``<p>``.

table(self self, header header, body body)

Rendering table element. Wrap header and body in it.

:param header: header part of the table.
:param body: body part of the table.

table_row(self self, content content)

Rendering a table row. Like ``<tr>``.

:param content: content of current table row.

table_cell(self self, content content, flags flags)

Rendering a table cell. Like ``<th>`` ``<td>``.

:param content: content of current table cell.
:param header: whether this is header or not.
:param align: align of current table cell.

double_emphasis(self self, text text)

Rendering **strong** text.

:param text: text content for emphasis.

emphasis(self self, text text)

Rendering *emphasis* text.

:param text: text content for emphasis.

codespan(self self, text text)

Rendering inline `code` text.

:param text: text content for inline code.

linebreak(self self)

Rendering line break like ``<br>``.

strikethrough(self self, text text)

Rendering ~~strikethrough~~ text.

:param text: text content for strikethrough.

text(self self, text text)

Rendering unformatted text.

:param text: text content.

escape(self self, text text)

Rendering escape sequence.

:param text: text content.

Rendering a given link or email address.

:param link: link content or email address.
:param is_email: whether this is an email or not.

Rendering a given link with content and title.

:param link: href link for ``<a>`` tag.
:param title: title content for `title` attribute.
:param text: text content for description.

image(self self, src src, title title, text text)

Rendering a image with title and text.

:param src: source link of the image.
:param title: title text of the image.
:param text: alt text of the image.

inline_html(self self, html html)

Rendering span level pure html content.

:param html: text content of the html snippet.

newline(self self)

Rendering newline element.

footnote_ref(self self, key key, index index)

Rendering the ref anchor of a footnote.

:param key: identity key for the footnote.
:param index: the index count of current footnote.

footnote_item(self self, key key, text text)

Rendering a footnote item.

:param key: identity key for the footnote.
:param text: text content of the footnote.

footnotes(self self, text text)

Wrapper for all footnotes.

:param text: contents of all footnotes.

Public Members

options