Python implementation of the HTML::Pipeline Ruby library.
Python Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

HTML-Pypeline Build Status

HTML Pypeline is a python implementation of the HTML::Pipeline ruby library.

It applies a number of different filters (like a pipeline) to the provided content, rendering, for example, Markdown to HTML with emojis.


Until it is on pypi, you need to install it by hand:

python install


import pypeline

filters = [
markdown = """\
# Test

**Testing this**

## @mention

@user testing

pipeline = pypeline.Pipeline(filters)
html = pipeline.render(markdown)


Most of the filters provided by HTML::Pipeline are also provided here.

Filters that are currently completed:

  • MarkdownFilter*: Markdown -> HTML
  • PlainTextInputFilter*: Escapes HTML tags and wraps in a div
  • AutolinkFilter: Automatic linking of URLs
  • MentionFilter: Replace @mentions with a URL
  • SyntaxHighlightFilter: Syntax highlighting

*Only one of these can be used at a time, and they must be the first filter in the pipeline.

Filters that are being worked on:

  • EmojiFilter: Replace emoji tags with images
  • HttpsFilter: Replace HTTP URLs with HTTPS
  • ImageMaxWidthFilter: Link to the full size image when creating image previews
  • TextileFilter: Textile -> HTML
  • TableOfContentsFilter: Adds the name attribute to headers

Creating your own filter

Creating your own filter is simple, and you have two different implementation options.

For simple filters, just create a closure:

def my_filter(context={}):
    def render(content):
        # do filtering
        # ...
        return filtered

    return render

For more complex filters, it might be easier to create a class. This class must respond to the __call__() method. The above example can also be written like:

class MyFilter(object):
    def __init__(self, context={}):
        self.context = context

    def __call__(self, content):
        # do filtering
        # ...
        return filtered



  1. Clone the repo
  2. Create a virtualenv
  3. Run ./script/bootstrap
  4. Run unit tests with nosetests (pip install nose coverage if you don't have nose installed)


  1. Fork it!
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request