From f2590e7b809c9b36dfbd2afcfdab185ae1fdcfce Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Fri, 3 Jan 2025 01:27:11 +0300 Subject: [PATCH] Check that the alert candidate is not already in an alert block or nested within other elements. --- src/Markdig/Extensions/Alerts/AlertInlineParser.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Markdig/Extensions/Alerts/AlertInlineParser.cs b/src/Markdig/Extensions/Alerts/AlertInlineParser.cs index 6f95c5b6..faf56859 100644 --- a/src/Markdig/Extensions/Alerts/AlertInlineParser.cs +++ b/src/Markdig/Extensions/Alerts/AlertInlineParser.cs @@ -29,7 +29,8 @@ public override bool Match(InlineProcessor processor, ref StringSlice slice) // We expect the alert to be the first child of a quote block. Example: // > [!NOTE] // > This is a note - if (processor.Block is not ParagraphBlock paragraphBlock || paragraphBlock.Parent is not QuoteBlock quoteBlock || paragraphBlock.Inline?.FirstChild != null) + if (processor.Block is not ParagraphBlock paragraphBlock || paragraphBlock.Parent is not QuoteBlock quoteBlock || paragraphBlock.Inline?.FirstChild != null + || quoteBlock is AlertBlock || quoteBlock.Parent is not MarkdownDocument) { return false; }