diff --git a/DiscordChatExporter.Core.Rendering/HtmlChatLogRenderer.cs b/DiscordChatExporter.Core.Rendering/HtmlChatLogRenderer.cs index c7a5d891..38fbd6e8 100644 --- a/DiscordChatExporter.Core.Rendering/HtmlChatLogRenderer.cs +++ b/DiscordChatExporter.Core.Rendering/HtmlChatLogRenderer.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Text.RegularExpressions; using System.Threading.Tasks; using DiscordChatExporter.Core.Markdown; using DiscordChatExporter.Core.Markdown.Nodes; @@ -145,7 +146,12 @@ namespace DiscordChatExporter.Core.Rendering // Link node if (node is LinkNode linkNode) { - return $"{HtmlEncode(linkNode.Title)}"; + // Extract message ID if the link points to a Discord message + var linkedMessageId = Regex.Match(linkNode.Url, "//discordapp.com/channels/[^/]+/\\d+/(\\d+)").Groups[1].Value; + + return linkedMessageId.IsNullOrWhiteSpace() + ? $"{HtmlEncode(linkNode.Title)}" + : $"{HtmlEncode(linkNode.Title)}"; } // All other nodes - simply return source diff --git a/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html b/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html index b639ad2f..d1283ddb 100644 --- a/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html +++ b/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html @@ -15,6 +15,20 @@ {{ ThemeStyleSheet }} + {{~ # Local scripts ~}} + + {{~ # Syntax highlighting ~}} @@ -78,7 +92,7 @@ {{~ # Messages ~}} {{~ for message in group.Messages ~}} -
+
{{~ # Content ~}} {{~ if message.Content ~}}