From 548a6f7945ad9f3ff90a504d362b01d0b1540ec8 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Tue, 4 Feb 2014 23:03:19 +0200 Subject: [PATCH] resolve #89 --- Parsedown.php | 2 +- tests/data/code_span.html | 4 +++- tests/data/code_span.md | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 040b774..efb11dc 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -974,7 +974,7 @@ class Parsedown case '`': - if (preg_match('/^(`+)(.+?)\1(?!`)/', $text, $matches)) + if (preg_match('/^(`+)[ ]*(.+?)[ ]*\1(?!`)/', $text, $matches)) { $element_text = $matches[2]; $element_text = htmlspecialchars($element_text, ENT_NOQUOTES, 'UTF-8'); diff --git a/tests/data/code_span.html b/tests/data/code_span.html index 67b28b1..351610a 100644 --- a/tests/data/code_span.html +++ b/tests/data/code_span.html @@ -1,3 +1,5 @@

a code span

this is also a codespan trailing text

-

and look at this one!

\ No newline at end of file +

and look at this one!

+

single backtick in a code span: `

+

backtick-delimited string in a code span: `foo`

\ No newline at end of file diff --git a/tests/data/code_span.md b/tests/data/code_span.md index 3b850fd..0654262 100644 --- a/tests/data/code_span.md +++ b/tests/data/code_span.md @@ -2,4 +2,8 @@ a `code span` `this is also a codespan` trailing text -`and look at this one!` \ No newline at end of file +`and look at this one!` + +single backtick in a code span: `` ` `` + +backtick-delimited string in a code span: `` `foo` `` \ No newline at end of file