Fixes for Android GN build input/outputs
[chromium-blink-merge.git] / third_party / markdown / extensions / extra.py
blobb368551f098b358756685ca6f4090100b308c843
1 # markdown is released under the BSD license
2 # Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
3 # Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
4 # Copyright 2004 Manfred Stienstra (the original version)
5 #
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # * Neither the name of the <organization> nor the
17 # names of its contributors may be used to endorse or promote products
18 # derived from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY
21 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 # DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT
24 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE.
33 """
34 Python-Markdown Extra Extension
35 ===============================
37 A compilation of various Python-Markdown extensions that imitates
38 [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/).
40 Note that each of the individual extensions still need to be available
41 on your PYTHONPATH. This extension simply wraps them all up as a
42 convenience so that only one extension needs to be listed when
43 initiating Markdown. See the documentation for each individual
44 extension for specifics about that extension.
46 In the event that one or more of the supported extensions are not
47 available for import, Markdown will issue a warning and simply continue
48 without that extension.
50 There may be additional extensions that are distributed with
51 Python-Markdown that are not included here in Extra. Those extensions
52 are not part of PHP Markdown Extra, and therefore, not part of
53 Python-Markdown Extra. If you really would like Extra to include
54 additional extensions, we suggest creating your own clone of Extra
55 under a differant name. You could also edit the `extensions` global
56 variable defined below, but be aware that such changes may be lost
57 when you upgrade to any future version of Python-Markdown.
59 """
61 from __future__ import absolute_import
62 from __future__ import unicode_literals
63 from . import Extension
65 extensions = ['smart_strong',
66 'fenced_code',
67 'footnotes',
68 'attr_list',
69 'def_list',
70 'tables',
71 'abbr',
75 class ExtraExtension(Extension):
76 """ Add various extensions to Markdown class."""
78 def extendMarkdown(self, md, md_globals):
79 """ Register extension instances. """
80 md.registerExtensions(extensions, self.config)
81 if not md.safeMode:
82 # Turn on processing of markdown text within raw html
83 md.preprocessors['html_block'].markdown_in_raw = True
85 def makeExtension(configs={}):
86 return ExtraExtension(configs=dict(configs))