diff options
-rw-r--r-- | Libraries/LibMarkdown/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Libraries/LibMarkdown/CodeBlock.cpp | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Libraries/LibMarkdown/CMakeLists.txt b/Libraries/LibMarkdown/CMakeLists.txt index bbe9cb9be1..ef7bc94edc 100644 --- a/Libraries/LibMarkdown/CMakeLists.txt +++ b/Libraries/LibMarkdown/CMakeLists.txt @@ -9,4 +9,4 @@ set(SOURCES ) serenity_lib(LibMarkdown markdown) -target_link_libraries(LibMarkdown LibC) +target_link_libraries(LibMarkdown LibJS) diff --git a/Libraries/LibMarkdown/CodeBlock.cpp b/Libraries/LibMarkdown/CodeBlock.cpp index dce8a19d67..2e7d533e7c 100644 --- a/Libraries/LibMarkdown/CodeBlock.cpp +++ b/Libraries/LibMarkdown/CodeBlock.cpp @@ -25,6 +25,7 @@ */ #include <AK/StringBuilder.h> +#include <LibJS/MarkupGenerator.h> #include <LibMarkdown/CodeBlock.h> namespace Markdown { @@ -60,7 +61,10 @@ String CodeBlock::render_to_html() const else 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>"); |