parse function
Parse an html5 document into a tree.
The input
can be a String
, a List<int>
of bytes, or an
HtmlTokenizer
.
If input
is not a HtmlTokenizer
, you can optionally specify the file's
encoding
, which must be a string. If specified that encoding will be
used regardless of any BOM or later declaration (such as in a meta element).
Set generateSpans
if you want to generate SourceSpan
s, otherwise the
Node.sourceSpan property will be null
. When using generateSpans
you
can additionally pass sourceUrl
to indicate where the input
was
extracted from.
Implementation
Document parse(dynamic input,
{String? encoding, bool generateSpans = false, String? sourceUrl}) {
final p = HtmlParser(input,
encoding: encoding, generateSpans: generateSpans, sourceUrl: sourceUrl);
return p.parse();
}