Skip to content
Discussion options

You must be logged in to vote

For your specific use case I would suggest using AngleSharp directly instead of HtmlSanitizer:

var parser = new HtmlParser();
var html = "foo bar <span>123</span> baz <script>alert('xss')</script> qux";
var doc = parser.ParseDocument(html);
var text = doc.Body.TextContent;
// "foo bar 123 baz alert('xss') qux"

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lonix1
Comment options

Answer selected by lonix1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants