diff --git a/DiscordChatExporter.Cli.Tests/TestData/ChannelIds.cs b/DiscordChatExporter.Cli.Tests/Infra/ChannelIds.cs
similarity index 86%
rename from DiscordChatExporter.Cli.Tests/TestData/ChannelIds.cs
rename to DiscordChatExporter.Cli.Tests/Infra/ChannelIds.cs
index e75f243c..56944fd2 100644
--- a/DiscordChatExporter.Cli.Tests/TestData/ChannelIds.cs
+++ b/DiscordChatExporter.Cli.Tests/Infra/ChannelIds.cs
@@ -1,6 +1,6 @@
using DiscordChatExporter.Core.Discord;
-namespace DiscordChatExporter.Cli.Tests.TestData;
+namespace DiscordChatExporter.Cli.Tests.Infra;
public static class ChannelIds
{
@@ -14,6 +14,8 @@ public static class ChannelIds
public static Snowflake FilterTestCases { get; } = Snowflake.Parse("866744075033641020");
+ public static Snowflake MarkdownTestCases { get; } = Snowflake.Parse("866459526819348521");
+
public static Snowflake MentionTestCases { get; } = Snowflake.Parse("866458801389174794");
public static Snowflake ReplyTestCases { get; } = Snowflake.Parse("866459871934677052");
diff --git a/DiscordChatExporter.Cli.Tests/Specs/CsvContentSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/CsvContentSpecs.cs
index 74ff0882..e0f047df 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/CsvContentSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/CsvContentSpecs.cs
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs
index b1edbaa9..4bea9796 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs
@@ -5,7 +5,6 @@ using System.Threading.Tasks;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Cli.Tests.Utils;
using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Exporting;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs
index 7eea6d5c..85b84831 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Cli.Tests.Utils;
using DiscordChatExporter.Core.Exporting;
using DiscordChatExporter.Core.Exporting.Filtering;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlAttachmentSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlAttachmentSpecs.cs
index c4432ff5..b3a9b7c0 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlAttachmentSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlAttachmentSpecs.cs
@@ -2,7 +2,6 @@
using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlContentSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlContentSpecs.cs
index 1c20cabd..dc896744 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlContentSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlContentSpecs.cs
@@ -2,7 +2,6 @@
using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs
index 98ba088c..1f4846e7 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs
@@ -2,7 +2,6 @@
using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
@@ -33,7 +32,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_an_image_link_is_rendered_with_an_image_embed()
+ public async Task Message_with_an_image_link_is_rendered_with_an_image_embed()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/537
@@ -53,7 +52,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_an_image_link_and_nothing_else_is_rendered_without_text_content()
+ public async Task Message_with_an_image_link_and_nothing_else_is_rendered_without_text_content()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/682
@@ -69,7 +68,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_a_gifv_link_is_rendered_with_a_video_embed()
+ public async Task Message_with_a_GIFV_link_is_rendered_with_a_video_embed()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
@@ -87,7 +86,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_a_gifv_link_and_nothing_else_is_rendered_without_text_content()
+ public async Task Message_with_a_GIFV_link_and_nothing_else_is_rendered_without_text_content()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
@@ -101,7 +100,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_a_Spotify_track_link_is_rendered_with_a_track_embed()
+ public async Task Message_with_a_Spotify_track_link_is_rendered_with_a_track_embed()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/657
@@ -117,7 +116,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_a_YouTube_video_link_is_rendered_with_a_video_embed()
+ public async Task Message_with_a_YouTube_video_link_is_rendered_with_a_video_embed()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/570
@@ -133,7 +132,7 @@ public class HtmlEmbedSpecs
}
[Fact]
- public async Task Message_containing_a_Twitter_post_link_with_multiple_images_is_rendered_as_a_single_embed()
+ public async Task Message_with_a_Twitter_post_link_with_multiple_images_is_rendered_as_a_single_embed()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/695
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs
index e504fb82..052683b9 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs
@@ -5,7 +5,6 @@ using AngleSharp.Dom;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Cli.Tests.Utils;
using DiscordChatExporter.Core.Exporting;
using FluentAssertions;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlMarkdownSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlMarkdownSpecs.cs
new file mode 100644
index 00000000..e4436729
--- /dev/null
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlMarkdownSpecs.cs
@@ -0,0 +1,136 @@
+using System.Threading.Tasks;
+using AngleSharp.Dom;
+using DiscordChatExporter.Cli.Tests.Infra;
+using DiscordChatExporter.Core.Discord;
+using FluentAssertions;
+using Xunit;
+
+namespace DiscordChatExporter.Cli.Tests.Specs;
+
+public class HtmlMarkdownSpecs
+{
+ [Fact]
+ public async Task Message_with_a_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323136411078787")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Default timestamp: 12-Feb-23 03:36 PM");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_short_time_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323205268967596")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Short time timestamp: 3:36 PM");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_long_time_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323235342139483")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Long time timestamp: 3:36:12 PM");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_short_date_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323326727634984")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Short date timestamp: 02/12/2023");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_long_date_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323350731640863")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Long date timestamp: February 12, 2023");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_full_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323374379118593")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Full timestamp: February 12, 2023 3:36 PM");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_full_long_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323409095376947")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Full long timestamp: Sunday, February 12, 2023 3:36 PM");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_a_relative_timestamp_is_rendered_as_the_default_timestamp()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074323436853285004")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Relative timestamp: 12-Feb-23 03:36 PM");
+ message.InnerHtml.Should().Contain("Sunday, February 12, 2023 3:36 PM");
+ }
+
+ [Fact]
+ public async Task Message_with_an_invalid_timestamp_is_rendered_correctly()
+ {
+ // Act
+ var message = await ExportWrapper.GetMessageAsHtmlAsync(
+ ChannelIds.MarkdownTestCases,
+ Snowflake.Parse("1074328534409019563")
+ );
+
+ // Assert
+ message.Text().Should().Contain("Invalid timestamp: Invalid date");
+ }
+}
\ No newline at end of file
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlMentionSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlMentionSpecs.cs
index 038e99d8..34efad36 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlMentionSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlMentionSpecs.cs
@@ -1,7 +1,6 @@
using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
@@ -11,7 +10,7 @@ namespace DiscordChatExporter.Cli.Tests.Specs;
public class HtmlMentionSpecs
{
[Fact]
- public async Task User_mention_is_rendered_correctly()
+ public async Task Message_with_a_user_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
@@ -25,7 +24,7 @@ public class HtmlMentionSpecs
}
[Fact]
- public async Task Text_channel_mention_is_rendered_correctly()
+ public async Task Message_with_a_text_channel_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
@@ -38,7 +37,7 @@ public class HtmlMentionSpecs
}
[Fact]
- public async Task Voice_channel_mention_is_rendered_correctly()
+ public async Task Message_with_a_voice_channel_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
@@ -51,7 +50,7 @@ public class HtmlMentionSpecs
}
[Fact]
- public async Task Role_mention_is_rendered_correctly()
+ public async Task Message_with_a_role_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlReplySpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlReplySpecs.cs
index 28d26149..8fcbb942 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlReplySpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlReplySpecs.cs
@@ -1,7 +1,6 @@
using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
@@ -11,7 +10,7 @@ namespace DiscordChatExporter.Cli.Tests.Specs;
public class HtmlReplySpecs
{
[Fact]
- public async Task Reply_to_a_normal_message_is_rendered_correctly()
+ public async Task Message_with_a_reply_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsHtmlAsync(
@@ -25,7 +24,7 @@ public class HtmlReplySpecs
}
[Fact]
- public async Task Reply_to_a_deleted_message_is_rendered_correctly()
+ public async Task Message_with_a_reply_to_a_deleted_message_is_rendered_correctly()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/645
@@ -43,7 +42,7 @@ public class HtmlReplySpecs
}
[Fact]
- public async Task Reply_to_an_empty_message_with_attachment_is_rendered_correctly()
+ public async Task Message_with_a_reply_to_an_empty_message_with_attachment_is_rendered_correctly()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/634
diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlStickerSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlStickerSpecs.cs
index a50b520d..3ade1552 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/HtmlStickerSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlStickerSpecs.cs
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/JsonAttachmentSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/JsonAttachmentSpecs.cs
index 585f8af0..583e9fe2 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/JsonAttachmentSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/JsonAttachmentSpecs.cs
@@ -1,7 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/JsonContentSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/JsonContentSpecs.cs
index cf6a17b4..c9d3883a 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/JsonContentSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/JsonContentSpecs.cs
@@ -1,7 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/JsonEmbedSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/JsonEmbedSpecs.cs
index b22b43e5..562688e8 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/JsonEmbedSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/JsonEmbedSpecs.cs
@@ -1,7 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/JsonMentionSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/JsonMentionSpecs.cs
index 26de91ac..dad66541 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/JsonMentionSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/JsonMentionSpecs.cs
@@ -1,7 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
@@ -11,7 +10,7 @@ namespace DiscordChatExporter.Cli.Tests.Specs;
public class JsonMentionSpecs
{
[Fact]
- public async Task User_mention_is_rendered_correctly()
+ public async Task Message_with_a_user_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsJsonAsync(
@@ -31,7 +30,7 @@ public class JsonMentionSpecs
}
[Fact]
- public async Task Text_channel_mention_is_rendered_correctly()
+ public async Task Message_with_a_text_channel_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsJsonAsync(
@@ -44,7 +43,7 @@ public class JsonMentionSpecs
}
[Fact]
- public async Task Voice_channel_mention_is_rendered_correctly()
+ public async Task Message_with_a_voice_channel_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsJsonAsync(
@@ -57,7 +56,7 @@ public class JsonMentionSpecs
}
[Fact]
- public async Task Role_mention_is_rendered_correctly()
+ public async Task Message_with_a_role_mention_is_rendered_correctly()
{
// Act
var message = await ExportWrapper.GetMessageAsJsonAsync(
diff --git a/DiscordChatExporter.Cli.Tests/Specs/JsonStickerSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/JsonStickerSpecs.cs
index 559ef019..074b576c 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/JsonStickerSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/JsonStickerSpecs.cs
@@ -1,7 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs
index d7360c74..41ba6952 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Cli.Tests.Utils;
using DiscordChatExporter.Core.Exporting;
using DiscordChatExporter.Core.Exporting.Partitioning;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/PlainTextContentSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/PlainTextContentSpecs.cs
index bbd4f18f..c4fbc7c9 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/PlainTextContentSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/PlainTextContentSpecs.cs
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
diff --git a/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs
index b058281a..9bf4a8a5 100644
--- a/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs
+++ b/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Cli.Tests.Infra;
-using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Cli.Tests.Utils;
using DiscordChatExporter.Core.Exporting;
using FluentAssertions;
diff --git a/DiscordChatExporter.Core/Discord/Data/Channel.cs b/DiscordChatExporter.Core/Discord/Data/Channel.cs
index e8299351..4ac1acca 100644
--- a/DiscordChatExporter.Core/Discord/Data/Channel.cs
+++ b/DiscordChatExporter.Core/Discord/Data/Channel.cs
@@ -19,7 +19,7 @@ public partial record Channel(
string? Topic,
Snowflake? LastMessageId) : IHasId
{
- public bool SupportsVoice => Kind is ChannelKind.GuildVoiceChat or ChannelKind.GuildStageVoice;
+ public bool IsVoice => Kind is ChannelKind.GuildVoiceChat or ChannelKind.GuildStageVoice;
}
public partial record Channel
@@ -92,4 +92,4 @@ public partial record Channel
lastMessageId
);
}
-}
+}
\ No newline at end of file
diff --git a/DiscordChatExporter.Core/Discord/Snowflake.cs b/DiscordChatExporter.Core/Discord/Snowflake.cs
index d8c64e30..194b1665 100644
--- a/DiscordChatExporter.Core/Discord/Snowflake.cs
+++ b/DiscordChatExporter.Core/Discord/Snowflake.cs
@@ -18,8 +18,8 @@ public partial record struct Snowflake
{
public static Snowflake Zero { get; } = new(0);
- public static Snowflake FromDate(DateTimeOffset date) => new(
- ((ulong)date.ToUnixTimeMilliseconds() - 1420070400000UL) << 22
+ public static Snowflake FromDate(DateTimeOffset instant) => new(
+ ((ulong)instant.ToUnixTimeMilliseconds() - 1420070400000UL) << 22
);
public static Snowflake? TryParse(string? str, IFormatProvider? formatProvider = null)
@@ -34,9 +34,9 @@ public partial record struct Snowflake
}
// As date
- if (DateTimeOffset.TryParse(str, formatProvider, DateTimeStyles.None, out var date))
+ if (DateTimeOffset.TryParse(str, formatProvider, DateTimeStyles.None, out var instant))
{
- return FromDate(date);
+ return FromDate(instant);
}
return null;
diff --git a/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs b/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs
index ad44e152..8288c88e 100644
--- a/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs
+++ b/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs
@@ -50,8 +50,8 @@ internal partial class ExportAssetDownloader
try
{
var lastModified = response.Content.Headers.TryGetValue("Last-Modified")?.Pipe(s =>
- DateTimeOffset.TryParse(s, CultureInfo.InvariantCulture, DateTimeStyles.None, out var date)
- ? date
+ DateTimeOffset.TryParse(s, CultureInfo.InvariantCulture, DateTimeStyles.None, out var instant)
+ ? instant
: (DateTimeOffset?) null
);
diff --git a/DiscordChatExporter.Core/Exporting/ExportContext.cs b/DiscordChatExporter.Core/Exporting/ExportContext.cs
index cd79e7bd..923aa9a9 100644
--- a/DiscordChatExporter.Core/Exporting/ExportContext.cs
+++ b/DiscordChatExporter.Core/Exporting/ExportContext.cs
@@ -38,11 +38,11 @@ internal class ExportContext
_assetDownloader = new ExportAssetDownloader(request.OutputAssetsDirPath, request.ShouldReuseAssets);
}
- public string FormatDate(DateTimeOffset date) => Request.DateFormat switch
+ public string FormatDate(DateTimeOffset instant) => Request.DateFormat switch
{
- "unix" => date.ToUnixTimeSeconds().ToString(),
- "unixms" => date.ToUnixTimeMilliseconds().ToString(),
- var format => date.ToLocalString(format)
+ "unix" => instant.ToUnixTimeSeconds().ToString(),
+ "unixms" => instant.ToUnixTimeMilliseconds().ToString(),
+ var format => instant.ToLocalString(format)
};
public Member? TryGetMember(Snowflake id) => Members.FirstOrDefault(m => m.Id == id);
diff --git a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs
index ecd92a39..edafa6bb 100644
--- a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs
+++ b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs
@@ -40,33 +40,45 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
var (openingTag, closingTag) = formatting.Kind switch
{
FormattingKind.Bold => (
+ // language=HTML
"",
+ // language=HTML
""
),
FormattingKind.Italic => (
+ // language=HTML
"",
+ // language=HTML
""
),
FormattingKind.Underline => (
+ // language=HTML
"",
+ // language=HTML
""
),
FormattingKind.Strikethrough => (
+ // language=HTML
"",
+ // language=HTML
""
),
FormattingKind.Spoiler => (
- "",
- ""
+ // language=HTML
+ """""",
+ // language=HTML
+ """"""
),
FormattingKind.Quote => (
- "
")
- .Append(HtmlEncode(inlineCodeBlock.Code))
- .Append("
");
+ _buffer.Append(
+ // language=HTML
+ $"""
+ {HtmlEncode(inlineCodeBlock.Code)}
+ """
+ );
return await base.VisitInlineCodeBlockAsync(inlineCodeBlock, cancellationToken);
}
@@ -95,14 +109,16 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
MultiLineCodeBlockNode multiLineCodeBlock,
CancellationToken cancellationToken = default)
{
- var highlightCssClass = !string.IsNullOrWhiteSpace(multiLineCodeBlock.Language)
+ var highlightClass = !string.IsNullOrWhiteSpace(multiLineCodeBlock.Language)
? $"language-{multiLineCodeBlock.Language}"
: "nohighlight";
- _buffer
- .Append($"")
- .Append(HtmlEncode(multiLineCodeBlock.Code))
- .Append("
");
+ _buffer.Append(
+ // language=HTML
+ $"""
+ {HtmlEncode(multiLineCodeBlock.Code)}
+ """
+ );
return await base.VisitMultiLineCodeBlockAsync(multiLineCodeBlock, cancellationToken);
}
@@ -111,7 +127,7 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
LinkNode link,
CancellationToken cancellationToken = default)
{
- // Try to extract message ID if the link refers to a Discord message
+ // Try to extract the message ID if the link points to a Discord message
var linkedMessageId = Regex.Match(
link.Url,
"^https?://(?:discord|discordapp).com/channels/.*?/(\\d+)/?$"
@@ -119,11 +135,15 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
_buffer.Append(
!string.IsNullOrWhiteSpace(linkedMessageId)
- ? $""
- : $""
+ // language=HTML
+ ? $""""""
+ // language=HTML
+ : $""""""
);
var result = await base.VisitLinkAsync(link, cancellationToken);
+
+ // language=HTML
_buffer.Append("");
return result;
@@ -137,13 +157,15 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor
var jumboClass = _isJumbo ? "chatlog__emoji--large" : "";
_buffer.Append(
- $"