Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix html entities double encoding in html attributes #783

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ protected function filterUnsafeUrlInAttribute(array $Element, $attribute)

protected static function escape($text, $allowQuotes = false)
{
return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');
return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8', false);
}

protected static function striAtStart($string, $needle)
Expand Down
3 changes: 2 additions & 1 deletion test/data/image_reference.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<p><img src="/md.png" alt="Markdown Logo" /></p>
<p>![missing reference]</p>
<p>![missing reference]</p>
<p><img src="/md.png" alt="Markdown Logo with html entity as used in french&nbsp;!" /></p>
4 changes: 3 additions & 1 deletion test/data/image_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

[image]: /md.png

![missing reference]
![missing reference]

![Markdown Logo with html entity as used in french&nbsp;!][image]