diff --git a/CHANGES.md b/CHANGES.md index de90da95..0bd48b18 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ ## python-markdown2 2.5.4 (not yet released) - [pull #617] Add MarkdownFileLinks extra (#528) +- [pull #622] Add missing block tags to regex (#620) ## python-markdown2 2.5.3 diff --git a/lib/markdown2.py b/lib/markdown2.py index 8387c0fd..a47df6a6 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -859,9 +859,9 @@ def _detab(self, text: str) -> str: # I broke out the html5 tags here and add them to _block_tags_a and # _block_tags_b. This way html5 tags are easy to keep track of. - _html5tags = '|article|aside|header|hgroup|footer|nav|section|figure|figcaption' + _html5tags = '|address|article|aside|canvas|figcaption|figure|footer|header|main|nav|section|video' - _block_tags_a = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|html|head|body' + _block_tags_a = 'blockquote|body|dd|del|div|dl|dt|fieldset|form|h[1-6]|head|hr|html|iframe|ins|li|math|noscript|ol|p|pre|script|style|table|tfoot|ul' _block_tags_a += _html5tags _strict_tag_block_re = re.compile(r""" @@ -877,7 +877,7 @@ def _detab(self, text: str) -> str: """ % _block_tags_a, re.X | re.M) - _block_tags_b = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math' + _block_tags_b = 'blockquote|div|dl|fieldset|form|h[1-6]|iframe|math|noscript|ol|p|pre|script|table|ul' _block_tags_b += _html5tags _span_tags = ( diff --git a/test/tm-cases/smarty_pants_issue620.html b/test/tm-cases/smarty_pants_issue620.html new file mode 100644 index 00000000..c409b145 --- /dev/null +++ b/test/tm-cases/smarty_pants_issue620.html @@ -0,0 +1,15 @@ +
Some HTML5 block level elements that should be hashed so that smarty-pants doesn’t interfere
+ + + jim@example.com