LibMarkdown: Wrap non-inline code blocks in <pre>

This fixes #7131

The parser already distinguishes between inline code (handled in
Text.cpp) and triple-tick code blocks, so only
CodeBlock::render_to_html() needed to change. Blank lines within
a code block still cause issues, but that's an HTML issue. (#7121)
This commit is contained in:
Sam Atkins 2021-06-09 15:03:27 +01:00 committed by Linus Groh
parent f437793788
commit a8946eb888
Notes: sideshowbarker 2024-07-18 12:33:06 +09:00

View file

@ -31,6 +31,8 @@ String CodeBlock::render_to_html() const
String style_language = this->style_language();
Text::Style style = this->style();
builder.append("<pre>");
if (style.strong)
builder.append("<b>");
if (style.emph)
@ -53,7 +55,7 @@ String CodeBlock::render_to_html() const
if (style.strong)
builder.append("</b>");
builder.append('\n');
builder.append("</pre>\n");
return builder.build();
}