Browse Source

LibMarkdown: Use escape_html_entities() from AK/String

Linus Groh 5 năm trước cách đây
mục cha
commit
fc3d16d664
1 tập tin đã thay đổi với 1 bổ sung9 xóa
  1. 1 9
      Libraries/LibMarkdown/CodeBlock.cpp

+ 1 - 9
Libraries/LibMarkdown/CodeBlock.cpp

@@ -61,15 +61,7 @@ String CodeBlock::render_to_html() const
         builder.appendf("<code style=\"white-space: pre;\" class=\"%s\">", style_language.characters());
 
     // TODO: This should also be done in other places.
-    for (size_t i = 0; i < m_code.length(); i++)
-        if (m_code[i] == '<')
-            builder.append("&lt;");
-        else if (m_code[i] == '>')
-            builder.append("&gt;");
-        else if (m_code[i] == '&')
-            builder.append("&amp;");
-        else
-            builder.append(m_code[i]);
+    builder.append(escape_html_entities(m_code));
 
     builder.append("</code>");