diff --git a/DiscordChatExporter.Core/Services/ExportService.TemplateModel.cs b/DiscordChatExporter.Core/Services/ExportService.TemplateModel.cs index 0aaa77a..39aff2d 100644 --- a/DiscordChatExporter.Core/Services/ExportService.TemplateModel.cs +++ b/DiscordChatExporter.Core/Services/ExportService.TemplateModel.cs @@ -77,7 +77,7 @@ namespace DiscordChatExporter.Core.Services private string FormatDate(DateTime dateTime) => Format(dateTime, _dateFormat); - private string FormatMarkdownPlainText(IEnumerable nodes) + private string FormatMarkdownPlainText(IReadOnlyList nodes) { var buffer = new StringBuilder(); @@ -127,7 +127,7 @@ namespace DiscordChatExporter.Core.Services private string FormatMarkdownPlainText(string input) => FormatMarkdownPlainText(MarkdownParser.Parse(input)); - private string FormatMarkdownHtml(IEnumerable nodes) + private string FormatMarkdownHtml(IReadOnlyList nodes, int depth = 0) { var buffer = new StringBuilder(); @@ -140,7 +140,7 @@ namespace DiscordChatExporter.Core.Services else if (node is FormattedNode formattedNode) { - var innerHtml = FormatMarkdownHtml(formattedNode.Children); + var innerHtml = FormatMarkdownHtml(formattedNode.Children, depth + 1); if (formattedNode.Formatting == TextFormatting.Bold) buffer.Append($"{innerHtml}"); @@ -165,6 +165,7 @@ namespace DiscordChatExporter.Core.Services else if (node is MultilineCodeBlockNode multilineCodeBlockNode) { + // Set language class for syntax highlighting var languageCssClass = multilineCodeBlockNode.Language.IsNotBlank() ? "language-" + multilineCodeBlockNode.Language : null; @@ -201,8 +202,15 @@ namespace DiscordChatExporter.Core.Services else if (node is EmojiNode emojiNode) { - var emoji = new Emoji(emojiNode.Id, emojiNode.Name, emojiNode.IsAnimated); - buffer.Append($""); + // Get emoji image URL + var emojiImageUrl = new Emoji(emojiNode.Id, emojiNode.Name, emojiNode.IsAnimated).ImageUrl; + + // Emoji can be jumboable if it's the only top-level node + var jumboableCssClass = depth == 0 && nodes.Count == 1 + ? "emoji--large" + : null; + + buffer.Append($""); } else if (node is LinkNode linkNode)