aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/blockprocessors.py2
-rw-r--r--tests/misc/h1.html4
-rw-r--r--tests/misc/h1.txt6
3 files changed, 10 insertions, 2 deletions
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index cc1d2a8..6396b4a 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -431,7 +431,7 @@ class SetextHeaderProcessor(BlockProcessor):
""" Process Setext-style Headers. """
# Detect Setext-style header. Must be first 2 lines of block.
- RE = re.compile(r'^.*?\n[=-]{3,}', re.MULTILINE)
+ RE = re.compile(r'^.*?\n[=-]+[ ]*(\n|$)', re.MULTILINE)
def test(self, parent, block):
return bool(self.RE.match(block))
diff --git a/tests/misc/h1.html b/tests/misc/h1.html
index fbf9b4d..886b61e 100644
--- a/tests/misc/h1.html
+++ b/tests/misc/h1.html
@@ -1,3 +1,5 @@
<h2>Header</h2>
<h1>Header 2</h1>
-<h3>H3</h3> \ No newline at end of file
+<h3>H3</h3>
+<h1>H1</h1>
+<h2>H2</h2> \ No newline at end of file
diff --git a/tests/misc/h1.txt b/tests/misc/h1.txt
index 0a1c8f9..f67b921 100644
--- a/tests/misc/h1.txt
+++ b/tests/misc/h1.txt
@@ -5,3 +5,9 @@ Header 2
========
### H3
+
+H1
+=
+
+H2
+--