don't escape text in pre tag (Fenced Code Blocks) (#67)
don't escape text in pre tag (Fenced Code Blocks)
This commit is contained in:
@@ -158,7 +158,7 @@ class MarkdownConverter(object):
|
||||
and el.parent.parent.name == 'pre')):
|
||||
text = whitespace_re.sub(' ', text)
|
||||
|
||||
if el.parent.name != 'code':
|
||||
if el.parent.name != 'code' and el.parent.name != 'pre':
|
||||
text = self.escape(text)
|
||||
|
||||
# remove trailing whitespaces if any of the following condition is true:
|
||||
|
||||
@@ -187,6 +187,7 @@ def test_p():
|
||||
def test_pre():
|
||||
assert md('<pre>test\n foo\nbar</pre>') == '\n```\ntest\n foo\nbar\n```\n'
|
||||
assert md('<pre><code>test\n foo\nbar</code></pre>') == '\n```\ntest\n foo\nbar\n```\n'
|
||||
assert md('<pre>this_should_not_escape</pre>') == '\n```\nthis_should_not_escape\n```\n'
|
||||
|
||||
|
||||
def test_s():
|
||||
|
||||
Reference in New Issue
Block a user