From b5e0ec1c81346a96b47e65380f1fd92289650221 Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Thu, 16 Feb 2023 02:11:52 +0200 Subject: [PATCH] Fix a few HTML rendering issues --- .../Exporting/MessageGroupTemplate.cshtml | 21 +++++++++++++------ .../Exporting/PreambleTemplate.cshtml | 5 +++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml index 209c4dc..3d1cf02 100644 --- a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml @@ -434,20 +434,29 @@ } // Generic image embed - else if (embed.Kind == EmbedKind.Image && !string.IsNullOrWhiteSpace(embed.Image?.Url)) + else if (embed.Kind == EmbedKind.Image && !string.IsNullOrWhiteSpace(embed.Url)) { + var embedImageUrl = + embed.Image?.ProxyUrl ?? embed.Image?.Url ?? + embed.Thumbnail?.ProxyUrl ?? embed.Thumbnail?.Url ?? + embed.Url; +
} // Generic gifv embed - else if (embed.Kind == EmbedKind.Gifv && !string.IsNullOrWhiteSpace(embed.Video?.Url)) + else if (embed.Kind == EmbedKind.Gifv && !string.IsNullOrWhiteSpace(embed.Url)) { + var embedVideoUrl = + embed.Video?.ProxyUrl ?? embed.Video?.Url ?? + embed.Url; + } diff --git a/DiscordChatExporter.Core/Exporting/PreambleTemplate.cshtml b/DiscordChatExporter.Core/Exporting/PreambleTemplate.cshtml index 0dc5ebe..60f4085 100644 --- a/DiscordChatExporter.Core/Exporting/PreambleTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/PreambleTemplate.cshtml @@ -583,6 +583,8 @@ } .chatlog__embed-generic-image { + object-fit: contain; + object-position: left; max-width: 45vw; max-height: 500px; vertical-align: top; @@ -590,6 +592,8 @@ } .chatlog__embed-generic-gifv { + object-fit: contain; + object-position: left; max-width: 45vw; max-height: 500px; vertical-align: top; @@ -744,6 +748,7 @@ background-color: @Themed("#2f3136", "#f9f9f9"); font-family: "Consolas", "Courier New", Courier, monospace; font-size: 0.85rem; + text-decoration: inherit; } .chatlog__markdown-pre--multiline {