Repository: Python-Markdown/markdown (python)

Issue:
HR preceeded by ***word*** doesn't render as HR
Input:

```
***test***
***
```

Output (second line will be rendered as a literal `***`):

```html
<p><strong><em>test</em></strong>
***</p>
```

Expected output according to Markdown.pl:

```html
<p><strong><em>test</em></strong>
</p>
<hr />
```

The same problem occurs with `---` and `___` as HR.

I think it can be fixed by changing `RE` in `HRProcessor`:

```diff
497c497
<     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,})[ ]*$'
```

Pull request description:
Fix HR which follows stromg em.
Fixes #897.

Patch:
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)
 


Test patch:
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(
             '**',