commit | 81ab348bb89310af0412ff52587fed776fe6e448 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch1@gmail.com> | Mon Oct 26 13:47:49 2020 -0700 |
committer | GitHub <noreply@github.com> | Mon Oct 26 13:47:49 2020 -0700 |
tree | 7989b51be12640180bac476fc5c779ba60bc7edc | |
parent | 143e79ef64ab9b8e9ab778fa5070b0730eec173a [diff] |
Avoid extra list for single character strings (#141) When we know the length to be 1, use `String.fromCharCode` instead of `String.fromCharCodes`. Read length from a String directly.
This is a pure Dart HTML5 parser. It's a port of html5lib from Python.
Parsing HTML is easy!
import 'package:html/parser.dart' show parse; import 'package:html/dom.dart'; main() { var document = parse( '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!'); print(document.outerHtml); }
You can pass a String or list of bytes to parse
. There's also parseFragment
for parsing a document fragment, and HtmlParser
if you want more low level control.