Skip to content

Commit e660fb3

Browse files
committed
Fix HR which follows strong em.
Fixes #897.
1 parent a4b6ec9 commit e660fb3

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

docs/change_log/release-3.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ The following new features have been included in the 3.3 release:
7070

7171
The following bug fixes are included in the 3.3 release:
7272

73+
* Fix HR which follows strong em (#897).
7374
* Support short reference image links (#894).
7475
* Avoid a `RecursionError` from deeply nested blockquotes (#799).
7576
* Fix issues with complex emphasis (#979).

markdown/blockprocessors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def run(self, parent, blocks):
495495
class HRProcessor(BlockProcessor):
496496
""" Process Horizontal Rules. """
497497

498-
RE = r'^[ ]{0,3}((-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,})[ ]*'
498+
RE = r'^[ ]{0,3}((-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,})[ ]*$'
499499
# Detect hr on any line of a block.
500500
SEARCH_RE = re.compile(RE, re.MULTILINE)
501501

tests/test_syntax/blocks/test_hr.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,22 @@ def test_hr_after_paragraph(self):
308308
)
309309
)
310310

311+
def test_hr_after_emstrong(self):
312+
self.assertMarkdownRenders(
313+
self.dedent(
314+
"""
315+
***text***
316+
***
317+
"""
318+
),
319+
self.dedent(
320+
"""
321+
<p><strong><em>text</em></strong></p>
322+
<hr />
323+
"""
324+
)
325+
)
326+
311327
def test_not_hr_2_asterisks(self):
312328
self.assertMarkdownRenders(
313329
'**',

0 commit comments

Comments
 (0)