[HTML] Mark code blocks without language so that highlight.js doesn't touch them

pull/236/head
Alexey Golub 5 years ago
parent 7b32101517
commit 29c35f6754

@ -92,12 +92,12 @@ namespace DiscordChatExporter.Core.Rendering
// Multi-line code block node // Multi-line code block node
if (node is MultilineCodeBlockNode multilineCodeBlockNode) if (node is MultilineCodeBlockNode multilineCodeBlockNode)
{ {
// Set language class for syntax highlighting // Set CSS class for syntax highlighting
var languageCssClass = !multilineCodeBlockNode.Language.IsNullOrWhiteSpace() var highlightCssClass = !multilineCodeBlockNode.Language.IsNullOrWhiteSpace()
? "language-" + multilineCodeBlockNode.Language ? $"language-{multilineCodeBlockNode.Language}"
: null; : "nohighlight";
return $"<div class=\"pre pre--multiline {languageCssClass}\">{HtmlEncode(multilineCodeBlockNode.Code)}</div>"; return $"<div class=\"pre pre--multiline {highlightCssClass}\">{HtmlEncode(multilineCodeBlockNode.Code)}</div>";
} }
// Mention node // Mention node

Loading…
Cancel
Save