API Documentation

Docstring for markdown

class tendril.utils.files.markdown.TendrilMistuneRenderer(**kwargs)[source]

Bases: mistune.Renderer

placeholder()[source]

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(code, lang=None)[source]

Rendering block level code. pre > code.

Parameters
  • code – text content of the code block.

  • lang – language of the given code.

block_quote(text)[source]

Rendering <blockquote> with the given text.

Parameters

text – text content of the blockquote.

block_html(html)[source]

Rendering block level pure html content.

Parameters

html – text content of the html snippet.

header(text, level, raw=None)[source]

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

Parameters
  • text – rendered text content for the header.

  • level – a number for the header level, for example: 1.

  • raw – raw text content of the header.

hrule()[source]

Rendering method for <hr> tag.

list(body, ordered=True)[source]

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

Parameters
  • body – body contents of the list.

  • ordered – whether this list is ordered or not.

list_item(text)[source]

Rendering list item snippet. Like <li>.

paragraph(text)[source]

Rendering paragraph tags. Like <p>.

table(header, body)[source]

Rendering table element. Wrap header and body in it.

Parameters
  • header – header part of the table.

  • body – body part of the table.

table_row(content)[source]

Rendering a table row. Like <tr>.

Parameters

content – content of current table row.

table_cell(content, **flags)[source]

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

Parameters
  • content – content of current table cell.

  • header – whether this is header or not.

  • align – align of current table cell.

double_emphasis(text)[source]

Rendering strong text.

Parameters

text – text content for emphasis.

emphasis(text)[source]

Rendering emphasis text.

Parameters

text – text content for emphasis.

codespan(text)[source]

Rendering inline code text.

Parameters

text – text content for inline code.

linebreak()[source]

Rendering line break like <br>.

strikethrough(text)[source]

Rendering ~~strikethrough~~ text.

Parameters

text – text content for strikethrough.

text(text)[source]

Rendering unformatted text.

Parameters

text – text content.

Rendering a given link or email address.

Parameters
  • link – link content or email address.

  • is_email – whether this is an email or not.

Rendering a given link with content and title.

Parameters
  • link – href link for <a> tag.

  • title – title content for title attribute.

  • text – text content for description.

image(src, title, text)[source]

Rendering a image with title and text.

Parameters
  • src – source link of the image.

  • title – title text of the image.

  • text – alt text of the image.

inline_html(html)[source]

Rendering span level pure html content.

Parameters

html – text content of the html snippet.

newline()[source]

Rendering newline element.

footnote_ref(key, index)[source]

Rendering the ref anchor of a footnote.

Parameters
  • key – identity key for the footnote.

  • index – the index count of current footnote.

footnote_item(key, text)[source]

Rendering a footnote item.

Parameters
  • key – identity key for the footnote.

  • text – text content of the footnote.

footnotes(text)[source]

Wrapper for all footnotes.

Parameters

text – contents of all footnotes.

class tendril.utils.files.markdown.MarkdownTreeContainer[source]

Bases: object

collapse_to_text()[source]
collapse_to_markup()[source]
tendril.utils.files.markdown.parse_markdown(fpath)[source]