-
Notifications
You must be signed in to change notification settings - Fork 883
Closed
Labels
bugBug report.Bug report.confirmedConfirmed bug report or approved feature request.Confirmed bug report or approved feature request.coreRelated to the core parser code.Related to the core parser code.
Milestone
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 = ""
Metadata
Metadata
Assignees
Labels
bugBug report.Bug report.confirmedConfirmed bug report or approved feature request.Confirmed bug report or approved feature request.coreRelated to the core parser code.Related to the core parser code.