diff options
-rw-r--r-- | Libraries/LibMarkdown/CodeBlock.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibMarkdown/Document.cpp | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Libraries/LibMarkdown/CodeBlock.cpp b/Libraries/LibMarkdown/CodeBlock.cpp index b6501ad03c..dce8a19d67 100644 --- a/Libraries/LibMarkdown/CodeBlock.cpp +++ b/Libraries/LibMarkdown/CodeBlock.cpp @@ -55,10 +55,10 @@ String CodeBlock::render_to_html() const if (style.emph) builder.append("<i>"); - if (style_language.is_null()) - builder.append("<code style=\"white-space: pre;\">"); + if (style_language.is_empty()) + builder.append("<code>"); else - builder.appendf("<code style=\"white-space: pre;\" class=\"%s\">", style_language.characters()); + builder.appendff("<code class=\"{}\">", style_language); builder.append(escape_html_entities(m_code)); diff --git a/Libraries/LibMarkdown/Document.cpp b/Libraries/LibMarkdown/Document.cpp index 2bd283c920..f418923701 100644 --- a/Libraries/LibMarkdown/Document.cpp +++ b/Libraries/LibMarkdown/Document.cpp @@ -40,7 +40,11 @@ String Document::render_to_html() const builder.append("<!DOCTYPE html>\n"); builder.append("<html>\n"); - builder.append("<head></head>\n"); + builder.append("<head>\n"); + builder.append("<style>\n"); + builder.append("code { white-space: pre; }\n"); + builder.append("</style>\n"); + builder.append("</head>\n"); builder.append("<body>\n"); for (auto& block : m_blocks) { |