Markdown.ToPlainText breaks </style> #481

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

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

I have simple program:

var mdText = "\r\n<!DOCTYPE html>\r\n<html>\r\n\r\n<head>\r\n\t<style>\r\n\r\n\t\t.functionname {\r\n\t\t\tfont-weight: bold;\r\n\t\t}\r\n\t</style>\r\n</head>\r\n\r\n<body>\r\n\t<span class=\"functionname\">GetEntityRecognitionInfo</span>\r\n</body>\r\n\r\n</html>";
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
Console.WriteLine(Markdown.ToPlainText(mdText, pipeline));

I assumed that nothing should change in the original line.
But for some reason, the closing style tag is missing characters.
Before:

<!DOCTYPE html>
<html>

<head>
        <style>

                .functionname {
                        font-weight: bold;
                }
        </style>
</head>

<body>
        <span class="functionname">GetEntityRecognitionInfo</span>
</body>

</html>

After:

<!DOCTYPE html>
<html>
<head>
        <style>
        .functionname {
                font-weight: bold;
        }
/style
</head>
<body>
        <span class="functionname">GetEntityRecognitionInfo</span>
</body>
</html>

Is this a bug?

Originally created by @HenreyMine on GitHub (Aug 18, 2021). I have simple program: ``` var mdText = "\r\n<!DOCTYPE html>\r\n<html>\r\n\r\n<head>\r\n\t<style>\r\n\r\n\t\t.functionname {\r\n\t\t\tfont-weight: bold;\r\n\t\t}\r\n\t</style>\r\n</head>\r\n\r\n<body>\r\n\t<span class=\"functionname\">GetEntityRecognitionInfo</span>\r\n</body>\r\n\r\n</html>"; var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); Console.WriteLine(Markdown.ToPlainText(mdText, pipeline)); ``` I assumed that nothing should change in the original line. But for some reason, the **closing style tag is missing characters**. Before: ``` <!DOCTYPE html> <html> <head> <style> .functionname { font-weight: bold; } </style> </head> <body> <span class="functionname">GetEntityRecognitionInfo</span> </body> </html> ``` After: ``` <!DOCTYPE html> <html> <head> <style> .functionname { font-weight: bold; } /style </head> <body> <span class="functionname">GetEntityRecognitionInfo</span> </body> </html> ``` Is this a bug?
claunia added the invalid label 2026-01-29 14:37:50 +00:00
Author
Owner

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

Similar issue to #569. HTML blocks should be contiguous without any blank line to make sure that HTML content is rendered correctly. You can't embed plain HTML content with CommonMark without following the specs to embed them.

@xoofx commented on GitHub (Aug 22, 2021): Similar issue to #569. HTML blocks should be contiguous without any blank line to make sure that HTML content is rendered correctly. You can't embed plain HTML content with CommonMark without following the specs to embed them.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#481