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