"Cannot add this block" 0.21.1 -> 0.22 #410

Closed
opened 2026-01-29 14:36:00 +00:00 by claunia · 6 comments
Owner

Originally created by @AndersMad on GitHub (Oct 8, 2020).

I get "Cannot add this block as it as already attached to another container (block.Parent != null)" after updating from 0.21.1 to 0.22 (nothing else changed)..

I'm a bit lost - any hints?

Originally created by @AndersMad on GitHub (Oct 8, 2020). I get **"Cannot add this block as it as already attached to another container (block.Parent != null)"** after updating from 0.21.1 to 0.22 (nothing else changed).. I'm a bit lost - any hints?
Author
Owner

@AndersMad commented on GitHub (Oct 12, 2020):

This seems to be happening in Microsoft.DocAsCode.MarkdigEngine.Extensions.MarkdownDocumentVisitor:

Markdig.Helpers.ThrowHelper.ArgumentException(String message)
Markdig.Syntax.ContainerBlock.set_Item(Int32 index, Block value)
Microsoft.DocAsCode.MarkdigEngine.Extensions.MarkdownDocumentVisitor.RewriteContainerBlock(ContainerBlock blocks)
Microsoft.DocAsCode.MarkdigEngine.Extensions.MarkdownDocumentVisitor.Visit(MarkdownDocument document)
Markdig.Parsers.ProcessDocumentDelegate.Invoke(MarkdownDocument document)
@AndersMad commented on GitHub (Oct 12, 2020): This seems to be happening in Microsoft.DocAsCode.MarkdigEngine.Extensions.MarkdownDocumentVisitor: ``` Markdig.Helpers.ThrowHelper.ArgumentException(String message) Markdig.Syntax.ContainerBlock.set_Item(Int32 index, Block value) Microsoft.DocAsCode.MarkdigEngine.Extensions.MarkdownDocumentVisitor.RewriteContainerBlock(ContainerBlock blocks) Microsoft.DocAsCode.MarkdigEngine.Extensions.MarkdownDocumentVisitor.Visit(MarkdownDocument document) Markdig.Parsers.ProcessDocumentDelegate.Invoke(MarkdownDocument document) ```
Author
Owner

@xoofx commented on GitHub (Oct 12, 2020):

You should report that on docfx repo then.

@xoofx commented on GitHub (Oct 12, 2020): You should report that on docfx repo then.
Author
Owner

@xoofx commented on GitHub (Oct 12, 2020):

In Markdig 0.22 we can no longer reuse a same node in multiple places

@xoofx commented on GitHub (Oct 12, 2020): In Markdig 0.22 we can no longer reuse a same node in multiple places
Author
Owner

@AndersMad commented on GitHub (Oct 12, 2020):

ok, mark me - I'll dig into it later :) closing this

@AndersMad commented on GitHub (Oct 12, 2020): ok, mark me - I'll dig into it later :) closing this
Author
Owner

@AndersMad commented on GitHub (Oct 13, 2020):

I misread this - this is merged into the v3 branch - not current release.. FYI if someone else gets here: https://github.com/dotnet/docfx/pull/6616

@AndersMad commented on GitHub (Oct 13, 2020): I misread this - this is merged into the v3 branch - not current release.. FYI if someone else gets here: https://github.com/dotnet/docfx/pull/6616
Author
Owner

@mungojam commented on GitHub (Oct 18, 2020):

a newbie question on this then. If I want to just take some blocks from one document and copy them to another document, how is that possible? Do I have to artificially remove them from the original?

@mungojam commented on GitHub (Oct 18, 2020): a newbie question on this then. If I want to just take some blocks from one document and copy them to another document, how is that possible? Do I have to artificially remove them from the original?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#410