Markdown.ToPlainText breaks </style> #478

Open
opened 2026-01-29 14:37:48 +00:00 by claunia · 0 comments
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:48 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#478