Fix crash in markdown-in-html
extra (#565)
#566
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR closes #565 by fixing a bug where an HTML snippet inside of a list could cause the library to crash when
markdown-in-html
is enabled.The issue is due to how
_markdown_in_html
handles indentation.In the above snippet, the HTML is placed inside a list because
_hash_html_blocks
doesn't work in lists (see #514), which means the snippet gets passed to_do_markdown_in_html
.The text is then dedented using
_uniform_outdent
which removes the smallest common leading indentation. Since the opening tag is indented further than the rest, it is left with a slight indentation.The block is then passed to
_hash_html_block_sub
where multiple regular expressions expect the tag to be right at the start of the line. This causes a match to return None and the library fails to get the first match group, causing the crash.