trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
396 stars 78 forks source link

HtmlToText results in empty string #352

Open alexaka1 opened 1 year ago

alexaka1 commented 1 year ago

Describe the bug This html results in an empty string. Am I missing something? (.Net 7)

var html = """<h1><font face="Arial">Hello this is a page.</font></h1><p><font face="Arial" size="4"><br></font></p><h1><font face="Arial" size="4">C&#237;m</font></h1><p><font face="Arial" size="4"><br></font></p><p><font face="Arial" size="4">Bekezd&#233;s</font></p>""";
var result = Uglify.HtmlToText(html, HtmlToTextOptions.None, null).Code;
Assert.Equal("", result); // this is true, should be false in my opinion

result.Errors is empty. Excepted output code Something like Hello this is a page. Cím Bekezdés

The html is generated by a user via a WYSIWYG editor.

trullock commented 1 year ago

This needs some investigation

Current workaround is to add <body></body> around your html fragment

EdiWang commented 7 months ago

+1 for same issue:

Uglify.HtmlToText("<h1>test</h1>")

returns empty Code

trullock commented 7 months ago

Pull requests welcome