diff --git a/markdown/core.py b/markdown/core.py index e2c0d88f7..79ca3f33d 100644 --- a/markdown/core.py +++ b/markdown/core.py @@ -276,14 +276,14 @@ def convert(self, source): '<%s>' % self.doc_tag) + len(self.doc_tag) + 2 end = output.rindex('' % self.doc_tag) output = output[start:end].strip() - except ValueError: # pragma: no cover + except ValueError as e: # pragma: no cover if output.strip().endswith('<%s />' % self.doc_tag): # We have an empty document output = '' else: # We have a serious problem raise ValueError('Markdown failed to strip top-level ' - 'tags. Document=%r' % output.strip()) + 'tags. Document=%r' % output.strip()) from e # Run the text post-processors for pp in self.postprocessors: