diff --git a/Parsedown.php b/Parsedown.php index ebc8097..8f36b8c 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -130,12 +130,12 @@ class Parsedown if ( ! isset($block['closed'])) { - if (strpos($line, $block['start']) !== false) # opening tag + if (stripos($line, $block['start']) !== false) # opening tag { $block['depth']++; } - if (strpos($line, $block['end']) !== false) # closing tag + if (stripos($line, $block['end']) !== false) # closing tag { if ($block['depth'] > 0) { @@ -359,8 +359,15 @@ class Parsedown { $name = $substring; } + $name = strtolower($name); - if ( ! ctype_alpha($name)) + // hr,h1,h2,h3,h4,h5,h6 cases + if ($name[0] == 'h' and strpos('r123456', $name[1]) !== false) + { + if ($name == 'hr') + $is_self_closing = 1; + } + elseif ( ! ctype_alpha($name)) { break; } @@ -392,7 +399,7 @@ class Parsedown 'depth' => 0, ); - if (strpos($outdented_line, $block['end'])) + if (stripos($outdented_line, $block['end'])) { $block['closed'] = true; } diff --git a/tests/data/html_simple.html b/tests/data/html_simple.html new file mode 100644 index 0000000..61e50b6 --- /dev/null +++ b/tests/data/html_simple.html @@ -0,0 +1,28 @@ +
Headings:
+blah
+blah
+blah
+Hr's:
+blah
+blah
+blah
+blah
+blah
+blah
+blah
+blah
+blah
\ No newline at end of file diff --git a/tests/data/html_simple.md b/tests/data/html_simple.md new file mode 100644 index 0000000..7b930df --- /dev/null +++ b/tests/data/html_simple.md @@ -0,0 +1,39 @@ +Headings: + +