Not Logged In

hoep 1.0.1

Install

Hoep is available on PyPI so installation is only a quick pip away.

$ pip install hoep

Unicode

Hoep only accepts and returns unicode objects in Python 2 and str objects in Python 3. This goes for custom renderers as well. All callbacks receive and must return unicode or str objects, respective to the Python version.

Basic Usage

Using Hoep is pretty straightforward. You can either use the render module function or the Hoep module class. The latter is more efficient if you are rendering multiple documents in a single go.

Custom renderer

By subclassing the Hoep class, you can create a custom renderer overriding various callbacks.

# -*- coding: utf-8 -*-from__future__importunicode_literalsimporthoepashclassMyRenderer(h.Hoep):def__init__(self,extensions=0,render_flags=0):# If you override the `__init__` function, you must call# the parent class's or bad things will happen.super(MyRenderer,self).__init__(extensions,render_flags)self.replace='[redacted]'defstrikethrough(self,text):returnself.replacemd=MyRenderer(h.EXT_STRIKETHROUGH)html=md.render('Some ~~bold~~ __"strong"__ text.')

Callbacks

Document level

preprocess(str markdown)

doc_header()

doc_footer()

postprocess(str html)

Block level

block_code(str text, str language)

block_html(str text)

block_quote(str text)

footnotes(str text)

footnote_def(str text, int number)

header(str text, int level)

hrule()

list(str text, bool ordered)

list_item(str text, bool ordered)

paragraph(str text)

table(str header, str body)

table_row(str text)

table_cell(str text, int flags)

Span level

autolink(str link, bool is_email)

codespan(str text)

double_emphasis(str text)

emphasis(str text)

footnote_ref(int number)

highlight(str text)

image(str link, mixed title, str alt)

line_break()

link(str link, mixed title, str content)

quote(str text)

raw_html_tag(str tag)

strikethrough(str text)

superscript(str text)

triple_emphasis(str text)

underline(str text)

Low-level

entity(str entity)

normal_text(str text)

Support

If you run into any issues or have any questions, either open an issue or hop in #mynt on irc.freenode.net.