From d5691b069d1110d485f545fd7420aade9e42842c Mon Sep 17 00:00:00 2001 From: Gemini Wen Date: Mon, 17 Oct 2016 19:26:26 +0800 Subject: [PATCH] add slash for inline code && add test for inline code --- Parser.php | 2 +- test/test.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Parser.php b/Parser.php index 34f8318..1ce52b8 100644 --- a/Parser.php +++ b/Parser.php @@ -259,7 +259,7 @@ function ($matches) use ($self) { // code $text = preg_replace_callback( - "/(^|[^\\\])(`+)(.+?)\\2/", + "/(^|[^\\\\])(`+)(.+?)\\2/", function ($matches) use ($self) { return $matches[1] . $self->makeHolder( '' . htmlspecialchars($matches[3]) . '' diff --git a/test/test.php b/test/test.php index e8bde41..4847729 100644 --- a/test/test.php +++ b/test/test.php @@ -44,6 +44,12 @@ function test($title, $specs) { } test('HyperDown', [ + 'code' => [ + "`code`" => [ + "Hello `World`", + "

Hello World

" + ] + ], 'footnote' => [ '脚注' => [ "Never write \"[click here][^2]\".\n [^2]: http://www.w3.org/QA/Tips/noClickHere",