LibMarkdown: Use escape_html_entities() from AK/String

This commit is contained in:
Linus Groh 2020-05-05 15:03:54 +01:00 committed by Andreas Kling
parent b7339745d0
commit fc3d16d664
Notes: sideshowbarker 2024-07-19 06:57:04 +09:00

View file

@ -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>");