diff --git a/Parsedown.php b/Parsedown.php index 9059f51..7cb4042 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -252,15 +252,6 @@ class Parsedown continue; } - # Horizontal Line - - if (isset($block) and preg_match('/^[ ]{0,3}([-*_])([ ]{0,2}\1){2,}$/', $block)) - { - $markup .= '
'."\n"; - - continue; - } - # ~ if (isset($quick_block)) @@ -270,6 +261,18 @@ class Parsedown unset ($quick_block); } + # Horizontal Line + # Horizontal lines checks could be optimized with $quick_block + # But '_' > 'A' and horizontal lines could be defined by underscores + # See #13 + + if (isset($block) and preg_match('/^[ ]{0,3}([-*_])([ ]{0,2}\1){2,}$/', $block)) + { + $markup .= '
'."\n"; + + continue; + } + # # Paragraph diff --git a/tests/data/horizontal_line.html b/tests/data/horizontal_line.html new file mode 100644 index 0000000..f121c06 --- /dev/null +++ b/tests/data/horizontal_line.html @@ -0,0 +1,6 @@ +

Horizontal line with dashes

+
+

Horizontal line with asterisks

+
+

Horizontal line with underscores

+
\ No newline at end of file diff --git a/tests/data/horizontal_line.md b/tests/data/horizontal_line.md new file mode 100644 index 0000000..56b540e --- /dev/null +++ b/tests/data/horizontal_line.md @@ -0,0 +1,11 @@ +Horizontal line with dashes + +--- + +Horizontal line with asterisks + +*** + +Horizontal line with underscores + +___ \ No newline at end of file