diff --git a/src/Prismic/Dom/RichText.php b/src/Prismic/Dom/RichText.php
index 48b90993..4de7a095 100644
--- a/src/Prismic/Dom/RichText.php
+++ b/src/Prismic/Dom/RichText.php
@@ -282,7 +282,7 @@ private static function serialize($element, $content, $linkResolver, $htmlSerial
                 $link = property_exists($element, 'linkTo') ? Link::asUrl($element->linkTo, $linkResolver) : null;
 
                 $target     = property_exists($element, 'linkTo') ? ($element->linkTo->target ?? null) : null;
-                $targetCode = $target ? ' target="' . $target . '"' : '';
+                $targetCode = $target ? ' target="' . htmlentities($target) . '"' : '';
 
                 return (
                     '<p class="block-img' . (isset($element->label) ? (' ' . $element->label) : '') . '">' .