Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in markdown-in-html extra (#565) #566

Merged

Conversation

Crozzers
Copy link
Contributor

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.

- one two
   <p markdown="1">
  def
  </p>
- three four

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.

@nicholasserra
Copy link
Collaborator

Thank you!

@nicholasserra nicholasserra merged commit 749ee72 into trentm:master Jan 23, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regression with markdown-in-html
2 participants