commit | 20497c60a81b808af5f40e6566ce10478237c9d3 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch1@gmail.com> | Mon Oct 05 16:30:13 2020 -0700 |
committer | GitHub <noreply@github.com> | Mon Oct 05 16:30:13 2020 -0700 |
tree | 93411d59f57bc7729ed3f9f50cf904a1b932c683 | |
parent | 22f17e97fedeacaa1e945cf84d8016284eed33a6 [diff] |
Disable implicit casts (#130) This will make it easier to migrate to null safety which also disables implicit casts except from dynamic. Also fix the implicit casts from dynamic since this package has a lot of dynamic code that is harder to read with implicit casts. - Add argument types to some signatures that should have had them from the start. - Add explicit casts. - Extract a few new local variables to make some of the casts only need to happen once. - Use `Iterable.whereType` in a loop instead of a type check and `continue` in the loop body.
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.