diff --git a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs index b4f5323..7946e68 100644 --- a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs @@ -89,20 +89,20 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor _buffer.Append(closingTag); } - protected override async ValueTask VisitHeaderAsync( - HeaderNode header, + protected override async ValueTask VisitHeadingAsync( + HeadingNode heading, CancellationToken cancellationToken = default) { _buffer.Append( // lang=html - $"" + $"" ); - await VisitAsync(header.Children, cancellationToken); + await VisitAsync(heading.Children, cancellationToken); _buffer.Append( // lang=html - $"" + $"" ); } diff --git a/DiscordChatExporter.Core/Markdown/HeaderNode.cs b/DiscordChatExporter.Core/Markdown/HeadingNode.cs similarity index 69% rename from DiscordChatExporter.Core/Markdown/HeaderNode.cs rename to DiscordChatExporter.Core/Markdown/HeadingNode.cs index 131860f..d5f59ec 100644 --- a/DiscordChatExporter.Core/Markdown/HeaderNode.cs +++ b/DiscordChatExporter.Core/Markdown/HeadingNode.cs @@ -2,7 +2,7 @@ namespace DiscordChatExporter.Core.Markdown; -internal record HeaderNode( +internal record HeadingNode( int Level, IReadOnlyList Children ) : MarkdownNode, IContainerNode; \ No newline at end of file diff --git a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs index f79a262..a101432 100644 --- a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs +++ b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs @@ -95,10 +95,10 @@ internal static partial class MarkdownParser (s, m) => new FormattingNode(FormattingKind.Quote, Parse(s.Relocate(m.Groups[1]))) ); - private static readonly IMatcher HeaderNodeMatcher = new RegexMatcher( + private static readonly IMatcher HeadingNodeMatcher = new RegexMatcher( // Consume the linebreak so that it's not attached to following nodes. new Regex(@"^(\#{1,3})\s(.+)\n", DefaultRegexOptions), - (s, m) => new HeaderNode(m.Groups[1].Length, Parse(s.Relocate(m.Groups[2]))) + (s, m) => new HeadingNode(m.Groups[1].Length, Parse(s.Relocate(m.Groups[2]))) ); private static readonly IMatcher ListNodeMatcher = new RegexMatcher( @@ -330,7 +330,7 @@ internal static partial class MarkdownParser MultiLineQuoteNodeMatcher, RepeatedSingleLineQuoteNodeMatcher, SingleLineQuoteNodeMatcher, - HeaderNodeMatcher, + HeadingNodeMatcher, ListNodeMatcher, // Code blocks diff --git a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownVisitor.cs b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownVisitor.cs index f0bfee7..a8df8f4 100644 --- a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownVisitor.cs @@ -16,10 +16,10 @@ internal abstract class MarkdownVisitor CancellationToken cancellationToken = default) => await VisitAsync(formatting.Children, cancellationToken); - protected virtual async ValueTask VisitHeaderAsync( - HeaderNode header, + protected virtual async ValueTask VisitHeadingAsync( + HeadingNode heading, CancellationToken cancellationToken = default) => - await VisitAsync(header.Children, cancellationToken); + await VisitAsync(heading.Children, cancellationToken); protected virtual async ValueTask VisitListAsync( ListNode list, @@ -72,9 +72,9 @@ internal abstract class MarkdownVisitor return; } - if (node is HeaderNode header) + if (node is HeadingNode heading) { - await VisitHeaderAsync(header, cancellationToken); + await VisitHeadingAsync(heading, cancellationToken); return; }