AlertBlock content not rending properly #662

Closed
opened 2026-01-29 14:42:25 +00:00 by claunia · 3 comments
Owner

Originally created by @jorge-moreira on GitHub (Mar 14, 2024).

Hi,

I was trying the new version and it seems that the paragraphs within the AlertBlock are not being rendered.

How to reproduce

Markdown example

> [!NOTE]
> Highlights information that users should take into account, even when skimming.
> 
> Testing rendering for multiple lines
> 
> `Inline code testing`
> 
> Other line
> 
> > Nested quote
> >
> > Final nested quote line
> 
> Final line of alert

Expected:

Note

Highlights information that users should take into account, even when skimming.

Testing rendering for multiple lines

Inline code testing

Other line

Nested quote

Final nested quote line

Final line of alert

HTML rendered result

<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title"><svg viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
<p>Highlights information that users should take into account, even when skimming.</p>
<p></p>
<p></p>
<p></p>
<blockquote>
<p></p>
<p></p>
</blockquote>
<p></p>
</div>

When debugging, I noticed that the paragraph block, when was being rendered, the ContainerInline is null, and that way, the paragraph is not rendered:
image

Originally created by @jorge-moreira on GitHub (Mar 14, 2024). Hi, I was trying the new version and it seems that the paragraphs within the `AlertBlock` are not being rendered. ### How to reproduce Markdown example ``` > [!NOTE] > Highlights information that users should take into account, even when skimming. > > Testing rendering for multiple lines > > `Inline code testing` > > Other line > > > Nested quote > > > > Final nested quote line > > Final line of alert ``` Expected: > [!NOTE] > Highlights information that users should take into account, even when skimming. > > Testing rendering for multiple lines > > `Inline code testing` > > Other line > > > Nested quote > > > > Final nested quote line > > Final line of alert ### HTML rendered result ``` <div class="markdown-alert markdown-alert-note"> <p class="markdown-alert-title"><svg viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p> <p>Highlights information that users should take into account, even when skimming.</p> <p></p> <p></p> <p></p> <blockquote> <p></p> <p></p> </blockquote> <p></p> </div> ``` --- When debugging, I noticed that the paragraph block, when was being rendered, the ContainerInline is null, and that way, the paragraph is not rendered: ![image](https://github.com/xoofx/markdig/assets/24962230/d2482c58-81a1-48a9-8987-4de86dcff356)
claunia added the bug label 2026-01-29 14:42:25 +00:00
Author
Owner

@xoofx commented on GitHub (Mar 14, 2024):

Thanks for the repro, indeed, it's not working at all 😅

The issue is in ProcessInlines.ProcessInlines that maintain the stack of the blocks being processed, as we are changing from an inline expansion the parent block, the loop doesn't pick-up the new parent, and as we removed all children from the QuoteBlock (replaced by an AlertBlock), then it exits the loop (and doesn't process the AlertBlock because it is not in the stack of the element being processed by the loop)

Gonna have to think about how to proceed. e.g It might not be a good idea to change the structure of blocks while parsing inlines, so I might have to remove AlertBlock and add attributes to the QuoteBlock.

@xoofx commented on GitHub (Mar 14, 2024): Thanks for the repro, indeed, it's not working at all 😅 The issue is in `ProcessInlines.ProcessInlines` that maintain the stack of the blocks being processed, as we are changing from an inline expansion the parent block, the loop doesn't pick-up the new parent, and as we removed all children from the QuoteBlock (replaced by an AlertBlock), then it exits the loop (and doesn't process the AlertBlock because it is not in the stack of the element being processed by the loop) Gonna have to think about how to proceed. e.g It might not be a good idea to change the structure of blocks while parsing inlines, so I might have to remove AlertBlock and add attributes to the QuoteBlock.
Author
Owner

@xoofx commented on GitHub (Mar 14, 2024):

Temporary fix 6549d3b726 until this is revisited. The fix is not ideal, so for now I kept the code internal.

@xoofx commented on GitHub (Mar 14, 2024): Temporary fix 6549d3b726b32146f3025204abb3bfeec53e3c1c until this is revisited. The fix is not ideal, so for now I kept the code internal.
Author
Owner

@jorge-moreira commented on GitHub (Mar 14, 2024):

Temporary fix 6549d3b until this is revisited. The fix is not ideal, so for now I kept the code internal.

I'll also take a look into it. Thank you once again 🙇

@jorge-moreira commented on GitHub (Mar 14, 2024): > Temporary fix [6549d3b](https://github.com/xoofx/markdig/commit/6549d3b726b32146f3025204abb3bfeec53e3c1c) until this is revisited. The fix is not ideal, so for now I kept the code internal. I'll also take a look into it. Thank you once again 🙇
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#662