Fix rendering of code blocks in HTML

pull/882/head
Oleksii Holub 2 years ago
parent bd0701cb82
commit 01389b7e28

@ -632,9 +632,11 @@
.chatlog__markdown-pre { .chatlog__markdown-pre {
background-color: @Themed("#2f3136", "#f9f9f9"); background-color: @Themed("#2f3136", "#f9f9f9");
font-family: "Consolas", "Courier New", Courier, monospace; font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 0.85rem;
} }
.chatlog__markdown-pre--multiline { .chatlog__markdown-pre--multiline {
display: block;
margin-top: 0.25rem; margin-top: 0.25rem;
padding: 0.5rem; padding: 0.5rem;
border: 2px solid @Themed("#282b30", "#f3f3f3"); border: 2px solid @Themed("#282b30", "#f3f3f3");
@ -643,14 +645,14 @@
} }
.chatlog__markdown-pre--multiline.hljs { .chatlog__markdown-pre--multiline.hljs {
background-color: inherit; background-color: @Themed("#2f3136", "#f9f9f9");
color: inherit; color: @Themed("#b9bbbe", "#657b83");
} }
.chatlog__markdown-pre--inline { .chatlog__markdown-pre--inline {
display: inline-block;
padding: 2px; padding: 2px;
border-radius: 3px; border-radius: 3px;
font-size: 0.85rem;
} }
.chatlog__markdown-mention { .chatlog__markdown-mention {

@ -76,9 +76,9 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
protected override MarkdownNode VisitInlineCodeBlock(InlineCodeBlockNode inlineCodeBlock) protected override MarkdownNode VisitInlineCodeBlock(InlineCodeBlockNode inlineCodeBlock)
{ {
_buffer _buffer
.Append("<span class=\"chatlog__markdown-pre chatlog__markdown-pre--inline\">") .Append("<code class=\"chatlog__markdown-pre chatlog__markdown-pre--inline\">")
.Append(HtmlEncode(inlineCodeBlock.Code)) .Append(HtmlEncode(inlineCodeBlock.Code))
.Append("</span>"); .Append("</code>");
return base.VisitInlineCodeBlock(inlineCodeBlock); return base.VisitInlineCodeBlock(inlineCodeBlock);
} }
@ -90,9 +90,9 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
: "nohighlight"; : "nohighlight";
_buffer _buffer
.Append($"<div class=\"chatlog__markdown-pre chatlog__markdown-pre--multiline {highlightCssClass}\">") .Append($"<code class=\"chatlog__markdown-pre chatlog__markdown-pre--multiline {highlightCssClass}\">")
.Append(HtmlEncode(multiLineCodeBlock.Code)) .Append(HtmlEncode(multiLineCodeBlock.Code))
.Append("</div>"); .Append("</code>");
return base.VisitMultiLineCodeBlock(multiLineCodeBlock); return base.VisitMultiLineCodeBlock(multiLineCodeBlock);
} }

Loading…
Cancel
Save