Markdown.TryGetFirstHeading Method

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Attempts to find the first ATX-style heading that appears before any non-heading content in the given Markdown text.
public static bool TryGetFirstHeading(ReadOnlySpan<char> content, [NotNullWhen(true)] out string heading)

Parameters

content ReadOnlySpan<char>
The Markdown content to inspect.
heading string
When this method returns, contains the heading text if found; otherwise, null.

Returns

bool
true if a heading was found and it appears before any non-heading content; otherwise, false.