From 7f9106965c28a1780164736e33c8244a8cc1c44b Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 1 Jun 2011 22:35:27 -0400 Subject: Fixed #15. Setext Headers now work with any number of - or = characters. --- markdown/blockprocessors.py | 2 +- tests/misc/h1.html | 4 +++- tests/misc/h1.txt | 6 ++++++ 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 @@

Header

Header 2

-

H3

\ No newline at end of file +

H3

+

H1

+

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 +-- -- cgit v1.2.3