How to find the id of a heading block #465

Closed
opened 2026-01-29 14:37:26 +00:00 by claunia · 1 comment
Owner

Originally created by @Youssef1313 on GitHub (May 18, 2021).

MarkdownDocument document = Markdown.Parse("### Hello, world"));
HeadingBlock block = document.Descendants<HeadingBlock>.First();
// From the given HeadingBlock, I want to find "hello-world".

Thanks in advance!

Originally created by @Youssef1313 on GitHub (May 18, 2021). ```csharp MarkdownDocument document = Markdown.Parse("### Hello, world")); HeadingBlock block = document.Descendants<HeadingBlock>.First(); // From the given HeadingBlock, I want to find "hello-world". ``` Thanks in advance!
Author
Owner

@Youssef1313 commented on GitHub (May 18, 2021):

Figured out that I should have used:

MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.Default).Build();
MarkdownDocument document = Markdown.Parse("### Hello, world", pipeline);
@Youssef1313 commented on GitHub (May 18, 2021): Figured out that I should have used: ```csharp MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.Default).Build(); MarkdownDocument document = Markdown.Parse("### Hello, world", pipeline); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#465