Block.Parent is sometimes null for child blocks #387

Closed
opened 2026-01-29 14:35:33 +00:00 by claunia · 0 comments
Owner

Originally created by @yufeih on GitHub (Aug 4, 2020).

This method changes the children list but it does not change the Parent property, causing some blocks to have null parents even though they are not root.

We currently use a hack to detect such cases. Markdig could fix this problem and ensure .Parent has the correct value for all markdown objects.

Originally created by @yufeih on GitHub (Aug 4, 2020). [This method](https://github.com/lunet-io/markdig/blob/master/src/Markdig/Syntax/ContainerBlock.cs#L219) changes the `children` list but it does not change the `Parent` property, causing some blocks to have `null` parents even though they are not root. We currently use [a hack](https://github.com/dotnet/docfx/blob/v3/src/docfx/lib/markdown/FilePathExtension.cs#L23) to detect such cases. Markdig could fix this problem and ensure `.Parent` has the correct value for all markdown objects.
claunia added the bugPR Welcome! labels 2026-01-29 14:35:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#387