Explorar o código

LibMarkdown: Avoid emitting <pre> tags for now, to help LibHTML

LibHTML can't handle block children of inline elements just yet.
Andreas Kling %!s(int64=5) %!d(string=hai) anos
pai
achega
b0d2117bfd
Modificáronse 1 ficheiros con 3 adicións e 5 borrados
  1. 3 5
      Libraries/LibMarkdown/MDCodeBlock.cpp

+ 3 - 5
Libraries/LibMarkdown/MDCodeBlock.cpp

@@ -27,12 +27,10 @@ String MDCodeBlock::render_to_html() const
     if (style.emph)
         builder.append("<i>");
 
-    builder.append("<pre>");
-
     if (style_language.is_null())
-        builder.append("<code>");
+        builder.append("<code style=\"white-space: pre;\">");
     else
-        builder.appendf("<code class=\"%s\">", style_language.characters());
+        builder.appendf("<code style=\"white-space: pre;\" class=\"%s\">", style_language.characters());
 
     // TODO: This should also be done in other places.
     for (int i = 0; i < m_code.length(); i++)
@@ -45,7 +43,7 @@ String MDCodeBlock::render_to_html() const
         else
             builder.append(m_code[i]);
 
-    builder.append("</code></pre>");
+    builder.append("</code>");
 
     if (style.emph)
         builder.append("</i>");