Closed
Description
This code section near the bottom of markdown.treeprocessors
raises AttributeError
if pre[0].text
is None
.
# Clean up extra empty lines at end of code blocks.
pres = root.iter('pre')
for pre in pres:
if len(pre) and pre[0].tag == 'code':
pre[0].text = util.AtomicString(pre[0].text.rstrip() + '\n')
The check should be if len(pre) and pre[0].tag == 'code' and pre[0].text is not None
or isinstance(pre[0].text, str)
, but that may be too strict.
I encountered this with a custom Block/Inline processor. The band-aid fix was just to ensure these elements had text.
for pre in root.iter("pre"):
if pre[0].text is None:
pre[0].text = ""