diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py index 870151bec..3d7a6ba48 100644 --- a/markdown/blockprocessors.py +++ b/markdown/blockprocessors.py @@ -243,10 +243,10 @@ def run(self, parent, blocks): ) else: # This is a new codeblock. Create the elements and insert text. - pre = util.etree.SubElement(parent, 'pre') - code = util.etree.SubElement(pre, 'code') + code = util.etree.SubElement(parent, 'pre') + pre = util.etree.SubElement(code, 'code') block, theRest = self.detab(block) - code.text = util.AtomicString('%s\n' % block.rstrip()) + pre.text = util.AtomicString('%s\n' % block.rstrip()) if theRest: # This block contained unindented line(s) after the first indented # line. Insert these lines as the first block of the master blocks