From 11ac7f6a59bf207ab9701932643a70016533b307 Mon Sep 17 00:00:00 2001 From: Cerdic Date: Mon, 24 Aug 2020 16:40:48 +0200 Subject: [PATCH] Fix html entities double encoding in html attributes --- Parsedown.php | 2 +- test/data/image_reference.html | 3 ++- test/data/image_reference.md | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index ae0cbde..d9d5c3a 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -1918,7 +1918,7 @@ class Parsedown 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) diff --git a/test/data/image_reference.html b/test/data/image_reference.html index 67fbd2c..71ee9be 100644 --- a/test/data/image_reference.html +++ b/test/data/image_reference.html @@ -1,2 +1,3 @@

Markdown Logo

-

![missing reference]

\ No newline at end of file +

![missing reference]

+

Markdown Logo with html entity as used in french !

\ No newline at end of file diff --git a/test/data/image_reference.md b/test/data/image_reference.md index 1e11d94..a427757 100644 --- a/test/data/image_reference.md +++ b/test/data/image_reference.md @@ -2,4 +2,6 @@ [image]: /md.png -![missing reference] \ No newline at end of file +![missing reference] + +![Markdown Logo with html entity as used in french !][image] \ No newline at end of file