mirror of
https://github.com/erusev/parsedown.git
synced 2025-01-17 12:48:28 +01:00
resolve #58
This commit is contained in:
parent
1017f22cdd
commit
f5dd3455f9
@ -825,9 +825,18 @@ class Parsedown
|
||||
|
||||
case '&':
|
||||
|
||||
$markup .= '&';
|
||||
if (preg_match('/^&#?\w+;/', $text, $matches))
|
||||
{
|
||||
$markup .= $matches[0];
|
||||
|
||||
$offset = substr($text, 0, 5) === '&' ? 5 : 1;
|
||||
$offset = strlen($matches[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$markup .= '&';
|
||||
|
||||
$offset = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
1
tests/data/html_entity.html
Normal file
1
tests/data/html_entity.html
Normal file
@ -0,0 +1 @@
|
||||
<p>& © {</p>
|
1
tests/data/html_entity.md
Normal file
1
tests/data/html_entity.md
Normal file
@ -0,0 +1 @@
|
||||
& © {
|
@ -1,5 +1,4 @@
|
||||
<p>AT&T has an ampersand in their name</p>
|
||||
<p>AT&T is another way to write it</p>
|
||||
<p>this & that</p>
|
||||
<p>4 < 5 and 6 > 5</p>
|
||||
<p><a href="http://example.com/autolink?a=1&b=2">http://example.com/autolink?a=1&b=2</a></p>
|
||||
|
@ -1,7 +1,5 @@
|
||||
AT&T has an ampersand in their name
|
||||
|
||||
AT&T is another way to write it
|
||||
|
||||
this & that
|
||||
|
||||
4 < 5 and 6 > 5
|
||||
|
Loading…
x
Reference in New Issue
Block a user