A default shared
HtmlParser that does not consume (decode)
character references.
- Namespace
- Statiq
.Common - Containing Type
- HtmlHelper
- Field Type
- HtmlParser
Syntax
public static readonly HtmlParser DefaultHtmlParser
Remarks
The default
HtmlParser has HtmlParserOptions.IsNotConsumingCharacterReferences
set to true so that character references are not decoded when parsing (which is important for passing
encoded characters like @ through to engines like Razor that require them to be encoded if literal).
This has the unfortunate side effect of triggering double-encoding on serialization,
see https://github.com/AngleSharp/AngleSharp/issues/396#issuecomment-246106539.
To avoid that, use StatiqMarkupFormatter or one of the extensions from
IMarkupFormattableExtensions or IElementExtensions whenever
serialization needs to be performed from a IHtmlDocument obtained from this method.