From 91cc086b679cabd67cde12f3bc292ca604556a8a Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 3 Sep 2014 09:21:48 +0000 Subject: [PATCH] * Markdown : remove http:// mandatory in links : can be relative ! * Markdown : add image support (http://daringfireball.net/projects/markdown/syntax ) git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1787 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- markdown.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/markdown.php b/markdown.php index baf3db3..62292ac 100644 --- a/markdown.php +++ b/markdown.php @@ -77,12 +77,15 @@ class markdown $search[] = "/\\n?\`((\\n|.)+)\`/Um"; $replace[] = "\\1"; - // LINKS + // LINKS (can be relative) + // images + $search[] = "(!\[(.+)\]\((.+)\))"; + $replace[] = "\\1"; // [Google Site](http://google.fr/ "With help bubble") - $search[] = "(\[(.+)\]\((https?://.+) \"(.+)\"\))"; + $search[] = "(\[(.+)\]\((.+) \"(.+)\"\))"; $replace[] = "\\1"; // [Google Site](http://google.fr/) - $search[] = "(\[(.+)\]\((http.+)\))"; $replace[] = "\\1"; + $search[] = "(\[(.+)\]\((.+)\))"; $replace[] = "\\1"; // Automatics links : // //