diff --git a/Parsedown.php b/Parsedown.php index 308da63..8d6ce06 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -205,7 +205,7 @@ class Parsedown # Setext Header (---) - if ($element['type'] === 'p' and preg_match('/^[-]+[ ]*$/', $line)) + if ($element['type'] === 'p' and ! isset($element['interrupted']) and preg_match('/^[-]+[ ]*$/', $line)) { $element['type'] = 'h.'; $element['level'] = 2; @@ -315,7 +315,7 @@ class Parsedown # Setext Header (===) - if ($element['type'] === 'p' and preg_match('/^[=]+[ ]*$/', $line)) + if ($element['type'] === 'p' and ! isset($element['interrupted']) and preg_match('/^[=]+[ ]*$/', $line)) { $element['type'] = 'h.'; $element['level'] = 1; diff --git a/tests/data/setext.html b/tests/data/setext.html deleted file mode 100644 index 0b00bb3..0000000 --- a/tests/data/setext.html +++ /dev/null @@ -1,2 +0,0 @@ -

line

-

line

\ No newline at end of file diff --git a/tests/data/setext.md b/tests/data/setext.md deleted file mode 100644 index 959ea3e..0000000 --- a/tests/data/setext.md +++ /dev/null @@ -1,5 +0,0 @@ -line -- - -line ----- \ No newline at end of file diff --git a/tests/data/setext_header.html b/tests/data/setext_header.html new file mode 100644 index 0000000..41f2b04 --- /dev/null +++ b/tests/data/setext_header.html @@ -0,0 +1,5 @@ +

h1

+

h2

+

single character

+

not a header

+
\ No newline at end of file diff --git a/tests/data/setext_header.md b/tests/data/setext_header.md new file mode 100644 index 0000000..49e03e0 --- /dev/null +++ b/tests/data/setext_header.md @@ -0,0 +1,12 @@ +h1 +== + +h2 +-- + +single character +- + +not a header + +------------ \ No newline at end of file