diff --git a/src/Markdig/Syntax/MarkdownObjectExtensions.cs b/src/Markdig/Syntax/MarkdownObjectExtensions.cs index 4875ae09..64433392 100644 --- a/src/Markdig/Syntax/MarkdownObjectExtensions.cs +++ b/src/Markdig/Syntax/MarkdownObjectExtensions.cs @@ -77,29 +77,7 @@ namespace Markdig.Syntax /// An iteration over the descendant elements /// public static IEnumerable Descendants(this ContainerInline inline) where T : Inline - { - var child = inline.FirstChild; - while (child != null) - { - var next = child.NextSibling; - T childT = child as T; - if (childT != null) - { - yield return childT; - } - - ContainerInline subContainer = child as ContainerInline; - if (subContainer != null) - { - foreach (var sub in subContainer.Descendants()) - { - yield return sub; - } - } - - child = next; - } - } + => inline.FindDescendants(); /// /// Iterates over the descendant elements for the specified markdown element and filters by the type {T}.