mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
LibMarkdown: Use JS::MarkupGenerator for "js" code blocks :^)
This commit is contained in:
parent
10c19d5207
commit
0aeef47abd
Notes:
sideshowbarker
2024-07-19 01:36:51 +09:00
Author: https://github.com/linusg
Commit: 0aeef47abd
Pull-request: https://github.com/SerenityOS/serenity/pull/3886
2 changed files with 6 additions and 2 deletions
|
@ -9,4 +9,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_lib(LibMarkdown markdown)
|
||||
target_link_libraries(LibMarkdown LibC)
|
||||
target_link_libraries(LibMarkdown LibJS)
|
||||
|
|
|
@ -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>");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue