1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:47:43 +00:00

LibMarkdown: Use JS::MarkupGenerator for "js" code blocks :^)

This commit is contained in:
Linus Groh 2020-10-31 18:13:17 +00:00 committed by Andreas Kling
parent 10c19d5207
commit 0aeef47abd
2 changed files with 6 additions and 2 deletions

View file

@ -9,4 +9,4 @@ set(SOURCES
) )
serenity_lib(LibMarkdown markdown) serenity_lib(LibMarkdown markdown)
target_link_libraries(LibMarkdown LibC) target_link_libraries(LibMarkdown LibJS)

View file

@ -25,6 +25,7 @@
*/ */
#include <AK/StringBuilder.h> #include <AK/StringBuilder.h>
#include <LibJS/MarkupGenerator.h>
#include <LibMarkdown/CodeBlock.h> #include <LibMarkdown/CodeBlock.h>
namespace Markdown { namespace Markdown {
@ -60,7 +61,10 @@ String CodeBlock::render_to_html() const
else else
builder.appendff("<code class=\"{}\">", style_language); builder.appendff("<code class=\"{}\">", style_language);
builder.append(escape_html_entities(m_code)); if (style_language == "js")
builder.append(JS::MarkupGenerator::html_from_source(m_code));
else
builder.append(escape_html_entities(m_code));
builder.append("</code>"); builder.append("</code>");