summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2020-07-01 10:08:47 -0400
committerWaylan Limberg <waylan.limberg@icloud.com>2020-07-01 10:18:28 -0400
commitbe7ba7bfa17e7cb0c795e101662d1e490334ec84 (patch)
tree15526e714d2111a1e7015cbe105c5eeda50e3908
parenta4b6ec9fcea353dd6f1c509ad6834aa6fd10564d (diff)
downloadpython-markdown-be7ba7bfa17e7cb0c795e101662d1e490334ec84.tar.gz
Fix HR which follows strong em.
Fixes #897.
-rw-r--r--docs/change_log/release-3.3.md1
-rw-r--r--markdown/blockprocessors.py2
-rw-r--r--tests/test_syntax/blocks/test_hr.py16
3 files changed, 18 insertions, 1 deletions
diff --git a/docs/change_log/release-3.3.md b/docs/change_log/release-3.3.md
index 897308c..dfbb384 100644
--- a/docs/change_log/release-3.3.md
+++ b/docs/change_log/release-3.3.md
@@ -70,6 +70,7 @@ The following new features have been included in the 3.3 release:
The following bug fixes are included in the 3.3 release:
+* Fix HR which follows strong em (#897).
* Support short reference image links (#894).
* Avoid a `RecursionError` from deeply nested blockquotes (#799).
* Fix issues with complex emphasis (#979).
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index 88ebb62..e81f83c 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -495,7 +495,7 @@ class SetextHeaderProcessor(BlockProcessor):
class HRProcessor(BlockProcessor):
""" Process Horizontal Rules. """
- RE = r'^[ ]{0,3}((-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,})[ ]*'
+ RE = r'^[ ]{0,3}((-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,})[ ]*$'
# Detect hr on any line of a block.
SEARCH_RE = re.compile(RE, re.MULTILINE)
diff --git a/tests/test_syntax/blocks/test_hr.py b/tests/test_syntax/blocks/test_hr.py
index 6f6cc88..009a39d 100644
--- a/tests/test_syntax/blocks/test_hr.py
+++ b/tests/test_syntax/blocks/test_hr.py
@@ -308,6 +308,22 @@ class TestHorizontalRules(TestCase):
)
)
+ def test_hr_after_emstrong(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ***text***
+ ***
+ """
+ ),
+ self.dedent(
+ """
+ <p><strong><em>text</em></strong></p>
+ <hr />
+ """
+ )
+ )
+
def test_not_hr_2_asterisks(self):
self.assertMarkdownRenders(
'**',