diff --git a/markdown.php b/markdown.php index c97da2f..2e5f43c 100644 --- a/markdown.php +++ b/markdown.php @@ -97,22 +97,22 @@ class markdown // TITLES // Titles ATX (Optionnal sharp at the end) // ###### Title6 - $search[] = "/^###### (.+)( +#*)$/Um"; + $search[] = "/^###### (.+)( +#+)?$/Um"; $replace[] = "

\\1

"; // ##### Title5 - $search[] = "/^##### (.+)( +#*)$/Um"; + $search[] = "/^##### (.+)( +#+)?$/Um"; $replace[] = "

\\1

"; // #### Title4 - $search[] = "/^#### (.+)( +#*)$/Um"; + $search[] = "/^#### (.+)( +#+)?$/Um"; $replace[] = "

\\1

"; // ### Title3 - $search[] = "/^### (.+)( +#*)$/Um"; + $search[] = "/^### (.+)( +#+)?$/Um"; $replace[] = "

\\1

"; // ## Title2 - $search[] = "/^## (.+)( +#*)$/Um"; + $search[] = "/^## (.+)( +#+)?$/Um"; $replace[] = "

\\1

"; // # Title1 - $search[] = "/^# (.+)( +#*)$/Um"; + $search[] = "/^# (.+)( +#+)?$/Um"; $replace[] = "

\\1

"; // End of line with double space :
$search[] = "/( )$/Um"; $replace[] = "
"; @@ -294,8 +294,6 @@ class markdown if (end ($typeStack)) { $this->debugMKD ("DEB2 : CODE : Close older HTML"); - // Remove last \n to put closing tag at the end of line - $res = substr ($res, 0, -1); $oldType = array_pop ($typeStack); $this->debugMKD (str_repeat (" ", end ($indentStack)).""); $res .= str_repeat (" ", end ($indentStack))."";