diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2015-03-14 20:39:46 -0400 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2018-01-11 19:04:49 -0500 |
commit | 7f63b20b819b83afef0ddadc2e210ddce32a2be3 (patch) | |
tree | c92e6bbd942e65588466c5800a32545fc1d57948 /markdown/extensions | |
parent | 6366e5ae8f0ae19c033a2c24c217001c1512292b (diff) | |
download | markdown-7f63b20b819b83afef0ddadc2e210ddce32a2be3.tar.gz markdown-7f63b20b819b83afef0ddadc2e210ddce32a2be3.tar.bz2 markdown-7f63b20b819b83afef0ddadc2e210ddce32a2be3.zip |
Removed deprecated safe_mode.
Diffstat (limited to 'markdown/extensions')
-rw-r--r-- | markdown/extensions/codehilite.py | 3 | ||||
-rw-r--r-- | markdown/extensions/extra.py | 17 | ||||
-rw-r--r-- | markdown/extensions/fenced_code.py | 2 | ||||
-rw-r--r-- | markdown/extensions/smarty.py | 2 | ||||
-rw-r--r-- | markdown/extensions/toc.py | 4 |
5 files changed, 12 insertions, 16 deletions
diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py index ee42d57..9c91c37 100644 --- a/markdown/extensions/codehilite.py +++ b/markdown/extensions/codehilite.py @@ -215,8 +215,7 @@ class HiliteTreeprocessor(Treeprocessor): tab_length=self.markdown.tab_length, use_pygments=self.config['use_pygments'] ) - placeholder = self.markdown.htmlStash.store(code.hilite(), - safe=True) + placeholder = self.markdown.htmlStash.store(code.hilite()) # Clear codeblock in etree instance block.clear() # Change to p element which will later diff --git a/markdown/extensions/extra.py b/markdown/extensions/extra.py index 587ba64..f59e09e 100644 --- a/markdown/extensions/extra.py +++ b/markdown/extensions/extra.py @@ -58,15 +58,14 @@ class ExtraExtension(Extension): def extendMarkdown(self, md, md_globals): """ Register extension instances. """ md.registerExtensions(extensions, self.config) - if not md.safeMode: - # Turn on processing of markdown text within raw html - md.preprocessors['html_block'].markdown_in_raw = True - md.parser.blockprocessors.add('markdown_block', - MarkdownInHtmlProcessor(md.parser), - '_begin') - md.parser.blockprocessors.tag_counter = -1 - md.parser.blockprocessors.contain_span_tags = re.compile( - r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE) + # Turn on processing of markdown text within raw html + md.preprocessors['html_block'].markdown_in_raw = True + md.parser.blockprocessors.add('markdown_block', + MarkdownInHtmlProcessor(md.parser), + '_begin') + md.parser.blockprocessors.tag_counter = -1 + md.parser.blockprocessors.contain_span_tags = re.compile( + r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE) def makeExtension(*args, **kwargs): diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py index 392c654..0975bb5 100644 --- a/markdown/extensions/fenced_code.py +++ b/markdown/extensions/fenced_code.py @@ -92,7 +92,7 @@ class FencedBlockPreprocessor(Preprocessor): code = self.CODE_WRAP % (lang, self._escape(m.group('code'))) - placeholder = self.markdown.htmlStash.store(code, safe=True) + placeholder = self.markdown.htmlStash.store(code) text = '%s\n%s\n%s' % (text[:m.start()], placeholder, text[m.end():]) diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py index c2af7cd..ba5b6b6 100644 --- a/markdown/extensions/smarty.py +++ b/markdown/extensions/smarty.py @@ -163,7 +163,7 @@ class SubstituteTextPattern(HtmlPattern): if isinstance(part, int): result += m.group(part) else: - result += self.markdown.htmlStash.store(part, safe=True) + result += self.markdown.htmlStash.store(part) return result diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py index b222cb4..f884f9b 100644 --- a/markdown/extensions/toc.py +++ b/markdown/extensions/toc.py @@ -49,11 +49,9 @@ def stashedHTML2text(text, md): def _html_sub(m): """ Substitute raw html with plain text. """ try: - raw, safe = md.htmlStash.rawHtmlBlocks[int(m.group(1))] + raw = md.htmlStash.rawHtmlBlocks[int(m.group(1))] except (IndexError, TypeError): # pragma: no cover return m.group(0) - if md.safeMode and not safe: # pragma: no cover - return '' # Strip out tags and entities - leaveing text return re.sub(r'(<[^>]+>)|(&[\#a-zA-Z0-9]+;)', '', raw) |