Markdown.ToHtml does not work. #483

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

Originally created by @HenreyMine on GitHub (Aug 19, 2021).

I have simple program:

var mdText = "<!DOCTYPE html>`EntityRecognitionInfo`";
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
Console.WriteLine(Markdown.ToHtml(mdText, pipeline));

But the original string doesn't change in any way.
I was expecting the following text in the output:
<!DOCTYPE html><code>EntityRecognitionInfo</code>
Is it a bug?

Originally created by @HenreyMine on GitHub (Aug 19, 2021). I have simple program: ``` var mdText = "<!DOCTYPE html>`EntityRecognitionInfo`"; var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); Console.WriteLine(Markdown.ToHtml(mdText, pipeline)); ``` But the original string doesn't change in any way. I was expecting the following text in the output: `<!DOCTYPE html><code>EntityRecognitionInfo</code>` Is it a bug?
claunia added the invalid label 2026-01-29 14:37:52 +00:00
Author
Owner

@xoofx commented on GitHub (Aug 22, 2021):

Is it a bug?

No, it's per the CommonnMark specs. An HTML block will escape the entire current line and consider the following as HTML.

See the behavior of other markdown engines.

@xoofx commented on GitHub (Aug 22, 2021): > Is it a bug? No, it's per the CommonnMark [specs](https://spec.commonmark.org/0.29/#html-blocks). An HTML block will escape the entire current line and consider the following as HTML. See the behavior of other [markdown engines](https://babelmark.github.io/?text=%3C!DOCTYPE+html%3E%60EntityRecognitionInfo%60).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#483