Fix crash in markdown-in-html extra (#565)#566
Merged
nicholasserra merged 3 commits intotrentm:masterfrom Jan 23, 2024
Merged
Conversation
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-htmlis enabled.The issue is due to how
_markdown_in_htmlhandles indentation.In the above snippet, the HTML is placed inside a list because
_hash_html_blocksdoesn't work in lists (see #514), which means the snippet gets passed to_do_markdown_in_html.The text is then dedented using
_uniform_outdentwhich 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_subwhere 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.