trentm / python-markdown2

markdown2: A fast and complete implementation of Markdown in Python
Other
2.66k stars 433 forks source link

Fix HTML elements not unhashing correctly (issue 508) #509

Closed Crozzers closed 1 year ago

Crozzers commented 1 year ago

This PR fixes #508 by patching the close tag detection in the strict block tag hashing function.

The issue was with lines such as:

<div><div></div>
</div>

Where the first opening <div> tag would be deemed as "closed" because there was a closing </div> tag present on the same line.

The fix is to count the number of opening and closing tags on a single line. If they are inequal, the tag is deemed "open".

nicholasserra commented 1 year ago

Thank you!