From a04b7c8aed335005951c7c0aa5280c5a7cba5d9f Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 3 Sep 2014 12:48:54 +0000 Subject: [PATCH] Correct the emphasis when there is multiple underscore or stars : cut at the first _ not, the last git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1791 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- markdown.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/markdown.php b/markdown.php index f7167d5..2e2f9d0 100644 --- a/markdown.php +++ b/markdown.php @@ -68,10 +68,10 @@ class markdown $search[] = "/^--+ (.+)( --+)?$/Um"; $replace[] = "

\n

\\1

\n

"; // EMPHASIS : _ or * for normal, __ or ** for strong - $search[] = "/__(.+)__/"; $replace[] = "\\1"; - $search[] = "/_(.+)_/"; $replace[] = "\\1"; - $search[] = "/\*\*(.+)\*\*/"; $replace[] = "\\1"; - $search[] = "/\*(.+)\*/"; $replace[] = "\\1"; + $search[] = "/__([^_]+)__/"; $replace[] = "\\1"; + $search[] = "/_([^_]+)_/"; $replace[] = "\\1"; + $search[] = "/\*\*([^*]+)\*\*/"; $replace[] = "\\1"; + $search[] = "/\*([^*]+)\*/"; $replace[] = "\\1"; // CODE : `code` -> $search[] = "/\\n?\`((\\n|.)+)\`/Um";