diff --git a/docs/changelog.md b/docs/changelog.md index 31cec0b2..879fbf43 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -16,6 +16,7 @@ See the [Contributing Guide](contributing.md) for details. * Fix a regression related to comment handling (#1590). * More reliable fix for ` bool: return bool(self.RE.match(block)) diff --git a/tests/test_syntax/blocks/test_headers.py b/tests/test_syntax/blocks/test_headers.py index da2ca14f..b1992ad3 100644 --- a/tests/test_syntax/blocks/test_headers.py +++ b/tests/test_syntax/blocks/test_headers.py @@ -109,6 +109,58 @@ def test_setext_h2_followed_by_p(self): # TODO: fix this # see https://johnmacfarlane.net/babelmark2/?normalize=1&text=Paragraph%0AAn+H1%0A%3D%3D%3D%3D%3D + + def test_setext_mixed_chars_not_h1(self): + """Mixed = and - chars should not form a valid H1.""" + self.assertMarkdownRenders( + self.dedent( + """ + This is not an H1 + =- + """ + ), + self.dedent( + """ +

This is not an H1 + =-

+ """ + ) + ) + + def test_setext_mixed_chars_not_h2(self): + """Mixed - and = chars should not form a valid H2.""" + self.assertMarkdownRenders( + self.dedent( + """ + This is not an H2 + -= + """ + ), + self.dedent( + """ +

This is not an H2 + -=

+ """ + ) + ) + + def test_setext_mixed_multiple_chars(self): + """Multiple mixed = and - chars should not form a valid H1/H2.""" + self.assertMarkdownRenders( + self.dedent( + """ + Not a Header + =-=- + """ + ), + self.dedent( + """ +

Not a Header + =-=-

+ """ + ) + ) + @unittest.skip('This is broken in Python-Markdown') def test_p_followed_by_setext_h1(self): self.assertMarkdownRenders(