diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py index 3ed4cf07..71d8854e 100644 --- a/markdown/blockprocessors.py +++ b/markdown/blockprocessors.py @@ -494,7 +494,7 @@ class SetextHeaderProcessor(BlockProcessor): """ Process Setext-style Headers. """ # Detect Setext-style header. Must be first 2 lines of block. - RE = re.compile(r'^.*?\n[=-]+[ ]*(\n|$)', re.MULTILINE) + RE = re.compile(r'^.*?\n(?:[=]+|[-]+)[ ]*(\n|$)', re.MULTILINE) def test(self, parent: etree.Element, block: str) -> bool: return bool(self.RE.match(block))