From 9ef7095303787661b3d1f07888d77cf2a4a564eb Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 30 Jun 2014 11:24:57 +0000 Subject: [PATCH] markdown : BUG in Sharp Titles (if not ending by #, the title is not discovered) git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1507 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- markdown.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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))."";