Skip to content

Frequently Asked Questions

Tieson Trowbridge edited this page Mar 22, 2017 · 13 revisions

How to intercept/change the sanitizing?

HtmlSanitizer raises a number of events prior to performing it's sanitizing actions, all of which can be overridden by your own delegates. See the Hooks/Events topic for the available events.

Why is the format of the sanitized markup different than the input format (e.g. close tags)?

The default formatter outputs markup as HTML, which does not use self-closing tags. You can override that behavior by using the XhtmlFormatter, which will output XML-compliant HTML (i.e. self-closing tags).

Why is the AngleSharp dependency pinned to a version less than the head revision?

To put it simply, AngleSharp constantly introduces breaking changes in their API (see #78, #76 , #68, #64 and #53, for example).

Can I sanitize markup other than HTML (see e.g. #91, #103), like XML or MathML?

Strictly speaking, yes. HtmlSanitizer is optimized for HTML, though, so you're likely going to have to use some post-processing to get the correct output for other markup syntaxes. You'll also need to configure the AllowedTags and AllowedAttributes options for the tags and attributes your markup files can contain.

Clone this wiki locally