p-hatan/ mirror

pub repository

mirror.p-hatan.ir

html

0.12.1+1

A library for working with HTML documents. Previously known as html5lib.

Download archive

Readme

html5 parser in dart

This is a pure Dart html5 parser. It's a port of html5lib from Python. Since it's 100% Dart you can use it safely from a script or server side app.

Eventually the parse tree API will be compatible with dart:html, so the same code will work on the client and the server.

(Formally known as html5lib.)

Installation

Add this to your pubspec.yaml (or create it):

dependencies:
  html: any

Then run the Pub Package Manager (comes with the Dart SDK):

pub install

Usage

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.

Running Tests

./test/run.sh
Changelog

changelog

This file contains highlights of what changes on each version of the html package.

Pub version 0.12.0+1

  • Support csslib version 0.12.0.

Rename to package:html 0.12.0

  • package has been renamed to html

Pub version 0.12.0

  • switch from source_maps' Span class to source_span's SourceSpan class.

Pub version 0.11.0+2

  • expand the version constraint for csslib.

Pub version 0.10.0+1

  • use a more recent source_maps version.

Pub version 0.10.0

  • fix how document fragments are added in NodeList.add/addAll/insertAll.

Pub version 0.9.2-dev

  • add Node.text, Node.append, Document.documentElement
  • add Text.data, deprecate Node.value and Text.value.
  • deprecate Node.$dom_nodeType
  • added querySelector/querySelectorAll, deprecated query/queryAll. This matches the current APIs in dart:html.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add html
pubspec.yaml
name: html
version: 0.12.1+1
author: Dart Team <misc@dartlang.org>
description: A library for working with HTML documents. Previously known as html5lib.
homepage: https://github.com/dart-lang/html
environment:
  sdk: '>=1.2.0 <2.0.0'
dependencies:
  csslib: '>=0.10.0 <0.13.0'
  source_span: '>=1.0.0 <2.0.0'
  utf: '>=0.9.0 <0.10.0'
dev_dependencies:
  path: '>=0.9.0 <2.0.0'
  unittest: '>=0.10.0 <0.12.0'

Version history

VersionPublishedArchiveSHA-256
0.12.12015-03-05T17:09:20.587670ZDownload9d703adb8a0c5ac7c128d902fe7441b8eec622232fc447c1220bd384a1e588b6
0.12.1+12015-04-03T16:49:17.744980ZDownloadf45a0e612112669d4d985f4c6838cf4c8f23ed2e5f78eabecf1f8a17d19512c8
0.12.1+22015-07-06T18:34:13.252ZDownloadecdd2bda0e403f8ad186ae44f4a3b359f82db85f9a0b35768cf856db3f329fe1
0.12.22015-08-28T20:15:52.148ZDownload3da7e4c5c7b5a771e7f91dd03efede395955054e3c0f99ecb4d6bd3c3b19f256
0.12.2+12015-12-17T01:35:30.122ZDownloadba4a8ac6df5f9774733d4fe412598ca0edf858783ef83a1d2f2ffd1e55260ed6
0.12.2+22016-04-21T22:26:01.411ZDownload7712e2b66dc7e9317dca3345d01c87650cdb23aea6516403e0f9edeb8f80585c
0.13.02016-05-11T23:17:21.760ZDownloadb4586242cfbe8a38653cab86591c8dd45805f559c666bd0dfc138fecf7e0edec
0.13.12016-10-24T14:19:06.504ZDownload3df38f194934273d7aa6214ac017df0a61ee4c8cc42eb1fe1a6260370ad26eb3
0.13.22017-05-31T19:31:13.688587ZDownload49079e7b2de76cb370ded1c9264f508f3bc8701245a2922135550a8d534728b3
0.13.2+12017-12-22T00:36:10.098084ZDownload0388d00bc5fa31f106c3819268f88ec397084820b5cd0d202e17256d5d57bbac
0.13.2+22018-01-09T18:06:46.360245ZDownloadbdc984d6a220bab1412371e887a4edb86b26c89d50a488793bdf4cfc6682b5f8
0.13.3-dev2018-03-10T00:41:14.974656ZDownload421139b9b5751cb3db7ef6de1dc73f07cb788b0b934303ca6c064599aa203e5b
0.13.32018-03-10T00:43:39.168853ZDownload170bf947dc5d529bce3f0dfcfa3675c64ce41668eb66164d5b7b3450cc54f1b2
0.13.3+12018-05-30T15:58:52.959032ZDownload2ef9ea6aa7333ca9cffaf2243e12e2659b4d5ea841a16c883aef988925b09b37
0.13.3+22018-07-19T23:44:57.554313ZDownload541001dac7ad556b61e95a9b430f516fb9468c1969913394ab3ac93b016a9d37
0.13.3+32018-08-13T19:59:44.208935ZDownload4cace46b0dbcbb2cf22d353eb672a2cb80e2e881574e970b7ded20613200c4e8
0.13.4+12019-03-04T17:31:40.247026ZDownloade33e6793cb2d0c6abe51e17f249184a30e64fba7df53da1a953b72cee6d1cf4d
0.13.4+22019-04-11T01:10:18.105880ZDownload7da9d216cfd35679c53f73446304ea255b0df4991961ef2aadb07089ec6a87dc
0.14.02019-04-09T00:18:58.004487ZDownloadcb8188cae01503d9aadd8dfce9faafc18e3057e879cfdffb6fe4f13c87162a41
0.14.0+12019-04-11T15:12:44.830700ZDownload8e32551aefe4632376e46c0194ddf0a39fb7e9e9da409dbc5f090a1bcafe435b
0.14.0+22019-04-24T23:39:34.482292ZDownload4626ab4a13af7a29bf45b378f592fd142b3af015886610ac273688fd54c58588
0.14.0+32019-09-30T17:40:04.385868ZDownload820c300db9a6a9b7e5842bcbfb58c859e53f29d9fb4368c61aa19f8dafc36c92
0.14.0+42020-10-05T17:35:52.984710ZDownload49f0f00a6f85ecab782e641ad79377bfd4b4aea463178ac19cbf45ea8419c380
0.15.0-nullsafety.02021-02-01T18:12:07.903788ZDownloada5ae9ba08db7fdaae5b7a1b98752a4d09805c2777b49e3f07e642a3eb046bdc8
0.15.02021-02-11T16:19:13.722662ZDownloadbfef906cbd4e78ef49ae511d9074aebd1d2251482ef601a280973e8b58b51bbf
0.15.12022-10-19T20:12:25.552211ZDownloadd9793e10dbe0e6c364f4c59bf3e01fb33a9b2a674bc7a1081693dba0614b6269
0.15.22023-03-02T22:09:18.729383ZDownload79d498e6d6761925a34ee5ea8fa6dfef38607781d2fa91e37523474282af55cb
0.15.32023-05-03T19:20:04.063658ZDownload58e3491f7bf0b6a4ea5110c0c688877460d1a6366731155c4a4580e7ded773e8
0.15.42023-06-08T15:49:40.750727ZDownload3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a
0.15.52024-10-29T16:12:44.523258ZDownload1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec
0.15.5+12025-04-08T16:38:53.252765ZDownload9475be233c437f0e3637af55e7702cbbe5c23a68bd56e8a5fa2d426297b7c6c8
0.15.62025-04-24T07:43:35.278305ZDownload6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602
0.15.72026-08-28T20:42:28.160706ZDownload43b67b8f43321ab066817dfac5619596c98bb1b61624e77203bb4351785f9699

Dependencies

csslib "\u003e=0.10.0 \u003c0.13.0"

source_span "\u003e=1.0.0 \u003c2.0.0"

utf "\u003e=0.9.0 \u003c0.10.0"