mirror of
https://github.com/erusev/parsedown.git
synced 2024-09-19 19:41:29 +02:00
parent
95e9878fb0
commit
d25466fa8f
@ -1028,9 +1028,9 @@ class Parsedown
|
||||
|
||||
case '`':
|
||||
|
||||
if (preg_match('/^(`+)[ ]*(.+?)[ ]*\1(?!`)/', $text, $matches))
|
||||
if (preg_match('/^(`+)([ ]?)(.+?)\2\1(?!`)/', $text, $matches))
|
||||
{
|
||||
$element_text = $matches[2];
|
||||
$element_text = $matches[3];
|
||||
$element_text = htmlspecialchars($element_text, ENT_NOQUOTES, 'UTF-8');
|
||||
|
||||
$markup .= '<code>'.$element_text.'</code>';
|
||||
|
@ -2,4 +2,8 @@
|
||||
<p><code>this is also a codespan</code> trailing text</p>
|
||||
<p><code>and look at this one!</code></p>
|
||||
<p>single backtick in a code span: <code>`</code></p>
|
||||
<p>backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
<p>backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
<p>Trim spaces: <code>code</code></p>
|
||||
<p>Multiple spaces: <code> like that </code></p>
|
||||
<p>Unequal number of spaces: <code> like that </code></p>
|
||||
<p>Space only at the beginning: <code> code</code></p>
|
@ -6,4 +6,12 @@ a `code span`
|
||||
|
||||
single backtick in a code span: `` ` ``
|
||||
|
||||
backtick-delimited string in a code span: `` `foo` ``
|
||||
backtick-delimited string in a code span: `` `foo` ``
|
||||
|
||||
Trim spaces: `` code ``
|
||||
|
||||
Multiple spaces: `` like that ``
|
||||
|
||||
Unequal number of spaces: `` like that ``
|
||||
|
||||
Space only at the beginning: `` code``
|
Loading…
Reference in New Issue
Block a user