1#!/usr/bin/env python 2""" 3Python-Markdown Extra Extension 4=============================== 5 6A compilation of various Python-Markdown extensions that imitates 7[PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/). 8 9Note that each of the individual extensions still need to be available 10on your PYTHONPATH. This extension simply wraps them all up as a 11convenience so that only one extension needs to be listed when 12initiating Markdown. See the documentation for each individual 13extension for specifics about that extension. 14 15In the event that one or more of the supported extensions are not 16available for import, Markdown will issue a warning and simply continue 17without that extension. 18 19There may be additional extensions that are distributed with 20Python-Markdown that are not included here in Extra. Those extensions 21are not part of PHP Markdown Extra, and therefore, not part of 22Python-Markdown Extra. If you really would like Extra to include 23additional extensions, we suggest creating your own clone of Extra 24under a differant name. You could also edit the `extensions` global 25variable defined below, but be aware that such changes may be lost 26when you upgrade to any future version of Python-Markdown. 27 28""" 29 30import markdown 31 32extensions = ['fenced_code', 33 'footnotes', 34 'headerid', 35 'def_list', 36 'tables', 37 'abbr', 38 ] 39 40 41class ExtraExtension(markdown.Extension): 42 """ Add various extensions to Markdown class.""" 43 44 def extendMarkdown(self, md, md_globals): 45 """ Register extension instances. """ 46 md.registerExtensions(extensions, self.config) 47 48def makeExtension(configs={}): 49 return ExtraExtension(configs=dict(configs)) 50