aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/postprocessors.py8
-rw-r--r--tests/misc/html.html3
-rw-r--r--tests/misc/html.txt1
3 files changed, 11 insertions, 1 deletions
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py
index 80227bb..e5c2e06 100644
--- a/markdown/postprocessors.py
+++ b/markdown/postprocessors.py
@@ -44,6 +44,7 @@ class RawHtmlPostprocessor(Postprocessor):
""" Iterate over html stash and restore "safe" html. """
for i in range(self.markdown.htmlStash.html_counter):
html, safe = self.markdown.htmlStash.rawHtmlBlocks[i]
+ html = self.unescape(html)
if self.markdown.safeMode and not safe:
if str(self.markdown.safeMode).lower() == 'escape':
html = self.escape(html)
@@ -59,6 +60,13 @@ class RawHtmlPostprocessor(Postprocessor):
html)
return text
+ def unescape(self, html):
+ """ Unescape any markdown escaped text within inline html. """
+ for k, v in self.markdown.treeprocessors['inline'].stashed_nodes.items():
+ ph = markdown.INLINE_PLACEHOLDER % k
+ html = html.replace(ph, '\%s' % v)
+ return html
+
def escape(self, html):
""" Basic html escaping """
html = html.replace('&', '&')
diff --git a/tests/misc/html.html b/tests/misc/html.html
index cd6d4af..c4bad4f 100644
--- a/tests/misc/html.html
+++ b/tests/misc/html.html
@@ -10,4 +10,5 @@ Html with various attributes.
</div>
<p>And of course <script>blah</script>.</p>
-<p><a href="script&gt;stuff&lt;/script">this <script>link</a></p> \ No newline at end of file
+<p><a href="script&gt;stuff&lt;/script">this <script>link</a></p>
+<p>Some funky <x\]> inline stuff with markdown escaping syntax.</p> \ No newline at end of file
diff --git a/tests/misc/html.txt b/tests/misc/html.txt
index c08fe1d..b04b740 100644
--- a/tests/misc/html.txt
+++ b/tests/misc/html.txt
@@ -15,3 +15,4 @@ And of course <script>blah</script>.
[this <script>link](<script>stuff</script>)
+Some funky <x\]> inline stuff with markdown escaping syntax.