diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index 42f6316910a20e403ea9f90e6c5faecfc02fda9c..0fe2f48b322d62f2cfc53057cf61a944f6cc645c 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -24,7 +24,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
 
 <div class="highlighted-data #{h.user_color_scheme_class}">
   <div class="highlight">
-    <pre><code class="#{language}">#{code}</code></pre>
+    <pre><code class="#{language}">#{h.html_escape(code)}</code></pre>
   </div>
 </div>