Vereyon / HtmlRuleSanitizer

A rule based HTML sanitizer built on top of the HTML Agility pack
MIT License
63 stars 19 forks source link

Compare with HtmlSanitizer package #26

Open MNF opened 3 years ago

MNF commented 3 years ago

Can you provide in ReadMe Comparison with HtmlSanitizer package https://github.com/mganss/HtmlSanitizer? It’s hard to choose one, and description when one or another is more suitable will be useful.

runekock commented 3 years ago

HtmlSanitizer seems to be a more powerful and more complex solution.

For my purpose, I needed to change the code a bit, and then HtmlRuleSanitizer (and the underlying Html Agility Pack) proved much easier than HtmlSanitizer (based on the very challenging AngleSharp).

However, if you just need to use the code as-is, and don't care about the underlying complexity, then HtmlSanitizer may be the better choice.

Just my opinion as a user.

cakkermans commented 3 years ago

The primary difference with HtmlSanitizer is indeed the HTML parser being used in the background. The Html Agility Pack was not really maintained for some time in history, but is again maintained actively for the past years. HtmlSanitizer uses the AngleSharp package to parse HTML, which I read to be more strict (and thus less easy to work with low quality HTML code), but I have no personal experience with it.

In addition HtmlSanitizer allows for extensive CSS sanitization, which HtmlRuleSanitizer does not do.