|
| 1 | +# High5 |
| 2 | + |
| 3 | +[![Build Status][win-build-badge]][win-builds] |
| 4 | +[![Build Status][nix-build-badge]][nix-builds] |
| 5 | +[![NuGet][nuget-badge]][nuget-pkg] |
| 6 | +[![MyGet][myget-badge]][edge-pkgs] |
| 7 | + |
| 8 | +High5 is a [spec-compliant HTML][html] parser [.NET Standard][netstd] library. |
| 9 | +It parses HTML the way the latest version of your browser does. |
| 10 | + |
| 11 | +High5 was born by porting [parse5][parse5], which is in JavaScript, to C#. |
| 12 | + |
| 13 | +High5's parser is generic. It can work with any tree model for an HTML |
| 14 | +document. A default model implementation is supplied that builds a read-only |
| 15 | +tree of HTML nodes. |
| 16 | + |
| 17 | + |
| 18 | +## Examples |
| 19 | + |
| 20 | +Parse an HTML document: |
| 21 | + |
| 22 | +```c# |
| 23 | +var html = await new HttpClient().GetStringAsync("http://www.example.com/"); |
| 24 | +var document = Parser.Parse(html); |
| 25 | +``` |
| 26 | + |
| 27 | +Parse an HTML document: |
| 28 | + |
| 29 | +```c# |
| 30 | +var html = @" |
| 31 | + <div> |
| 32 | + <h1>Example Domain</h1> |
| 33 | + <p>This domain is established to be used for illustrative examples |
| 34 | + in documents. You may use this domain in examples without prior |
| 35 | + coordination or asking for permission.</p> |
| 36 | + <p><a href='http://www.iana.org/domains/example'>More information...</a></p> |
| 37 | + </div>"; |
| 38 | + |
| 39 | +var fragment = Parser.ParseFragment(html, null); |
| 40 | +``` |
| 41 | + |
| 42 | + |
| 43 | +[win-build-badge]: https://img.shields.io/appveyor/ci/raboof/high5.svg?label=windows |
| 44 | +[win-builds]: https://ci.appveyor.com/project/raboof/high5 |
| 45 | +[nix-build-badge]: https://img.shields.io/travis/atifaziz/High5.svg?label=linux |
| 46 | +[nix-builds]: https://travis-ci.org/atifaziz/High5 |
| 47 | +[myget-badge]: https://img.shields.io/myget/raboof/vpre/High5.svg?label=myget |
| 48 | +[edge-pkgs]: https://www.myget.org/feed/raboof/package/nuget/High5 |
| 49 | +[nuget-badge]: https://img.shields.io/nuget/v/High5.svg |
| 50 | +[nuget-pkg]: https://www.nuget.org/packages/High5 |
| 51 | +[html]: https://html.spec.whatwg.org |
| 52 | +[netstd]: https://docs.microsoft.com/en-us/dotnet/standard/net-standard |
| 53 | +[parse5]: https://github.com/inikulin/parse5 |
0 commit comments