用于(x)html合规性的C#库

时间:2022-09-17 14:16:10

Curious if anyone has come across a C# library which will clean up invalid html. Basically our CMS has some areas where we allow users to enter in HTML, and invariably this leads to some poorly formatted code.

好奇,如果有人遇到一个C#库,它将清理无效的HTML。基本上我们的CMS有一些区域允许用户输入HTML,并且这总是会导致一些格式不正确的代码。

Example - if someone puts in:

示例 - 如果有人投入:

<div><span>blah blah blah</div>

We'd like to rip out any unterminated tags to end up with:

我们想要删除任何未终止的标签,最终得到:

<div>blah blah blah</div>

Hoping to not re-invent the wheel here.

希望不要在这里重新发明*。

Thanks!

2 个解决方案

#1


There's a well-known library name "HTML Tidy": something like http://www.google.ca/search?hl=en&q=html+tidy+c%23 might help.

有一个着名的图书馆名称“HTML Tidy”:类似http://www.google.ca/search?hl=en&q=html+tidy+c%23可能有所帮助。

#2


Try this answer:

试试这个答案:

C# version of HTML Tidy?

C#版的HTML Tidy?

#1


There's a well-known library name "HTML Tidy": something like http://www.google.ca/search?hl=en&q=html+tidy+c%23 might help.

有一个着名的图书馆名称“HTML Tidy”:类似http://www.google.ca/search?hl=en&q=html+tidy+c%23可能有所帮助。

#2


Try this answer:

试试这个答案:

C# version of HTML Tidy?

C#版的HTML Tidy?