'Add pieces to Markdown.'

def extendMarkdown(self, md, md_globals):

    md.registerExtension(self)
    self.parser = md.parser
    md.preprocessors.add('footnote', FootnotePreprocessor(self), '<reference')
    FOOTNOTE_RE = '\\[\\^([^\\]]*)\\]'
    md.inlinePatterns.add('footnote', FootnotePattern(FOOTNOTE_RE, self), '<reference')
    md.treeprocessors.add('footnote', FootnoteTreeprocessor(self), '<inline')
    md.postprocessors.add('footnote', FootnotePostprocessor(self), '>amp_substitute')
