Error converting markdown with table in Html #608

Closed
opened 2026-01-29 14:41:04 +00:00 by claunia · 2 comments
Owner

Originally created by @CodingJarod on GitHub (Jun 28, 2023).

Hi,
I'm trying to convert a text with pipe table in it to html but I'm unable to match the expected result.

MarkdownDocument document = Markdown.Parse(stringWithMD, new MarkdownPipelineBuilder().UseAdvancedExtensions().Build());
result = document.ToHtml();

The document correctly identifies the table but when I execute the ToHtml it got converted in a series o

tag.

What am I missing?

Thanks

Originally created by @CodingJarod on GitHub (Jun 28, 2023). Hi, I'm trying to convert a text with pipe table in it to html but I'm unable to match the expected result. ``` MarkdownDocument document = Markdown.Parse(stringWithMD, new MarkdownPipelineBuilder().UseAdvancedExtensions().Build()); result = document.ToHtml(); ``` The document correctly identifies the table but when I execute the ToHtml it got converted in a series o <p> tag. What am I missing? Thanks
claunia added the question label 2026-01-29 14:41:04 +00:00
Author
Owner

@MihaZupan commented on GitHub (Jun 28, 2023):

You need to pass the pipeline to ToHtml as well. For performance reasons, you should also try to cache the pipeline object.

private static readonly MarkdownPipeline s_myPipeline = new MarkdownPipelineBuilder()
    .UseAdvancedExtensions()
    .Build();

MarkdownDocument document = Markdown.Parse(text, s_myPipeline);
string html = document.ToHtml(s_myPipeline); 
@MihaZupan commented on GitHub (Jun 28, 2023): You need to pass the pipeline to `ToHtml` as well. For performance reasons, you should also try to cache the pipeline object. ```c# private static readonly MarkdownPipeline s_myPipeline = new MarkdownPipelineBuilder() .UseAdvancedExtensions() .Build(); MarkdownDocument document = Markdown.Parse(text, s_myPipeline); string html = document.ToHtml(s_myPipeline); ```
Author
Owner

@CodingJarod commented on GitHub (Jun 28, 2023):

Thank you!

@CodingJarod commented on GitHub (Jun 28, 2023): Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#608