summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-05 15:03:54 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-05 16:18:11 +0200
commitfc3d16d6646f7977067eae3fb0feb103704506c7 (patch)
tree86a3a117f31d5486531a17e54f14905b3273a5aa
parentb7339745d0fa557f4156c8239f28118b929772ab (diff)
downloadserenity-fc3d16d6646f7977067eae3fb0feb103704506c7.zip
LibMarkdown: Use escape_html_entities() from AK/String
-rw-r--r--Libraries/LibMarkdown/CodeBlock.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/Libraries/LibMarkdown/CodeBlock.cpp b/Libraries/LibMarkdown/CodeBlock.cpp
index c940cd5322..ca27dad1bf 100644
--- a/Libraries/LibMarkdown/CodeBlock.cpp
+++ b/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>");