Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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 = (
Expand Down
15 changes: 15 additions & 0 deletions test/tm-cases/smarty_pants_issue620.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<p>Some HTML5 block level elements that should be hashed so that smarty-pants doesn&#8217;t interfere</p>

<address>
<a href="mailto:jim@example.com">jim@example.com</a><br />
<a href="tel:+14155550132">+1 (415) 555‑0132</a>
</address>

<canvas width="120" height="120">
An alternative text describing what your canvas displays.
</canvas>

<video height="640" width="382" controls loop>
<source src="images/door.mp4" type="video/mp4"/>
Test
</video>
1 change: 1 addition & 0 deletions test/tm-cases/smarty_pants_issue620.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"extras": ["smarty-pants"]}
15 changes: 15 additions & 0 deletions test/tm-cases/smarty_pants_issue620.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Some HTML5 block level elements that should be hashed so that smarty-pants doesn't interfere

<address>
<a href="mailto:jim@example.com">jim@example.com</a><br />
<a href="tel:+14155550132">+1 (415) 555‑0132</a>
</address>

<canvas width="120" height="120">
An alternative text describing what your canvas displays.
</canvas>

<video height="640" width="382" controls loop>
<source src="images/door.mp4" type="video/mp4"/>
Test
</video>