Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acrazing/html5parser
A super tiny and fast html5 AST parser.
https://github.com/acrazing/html5parser
ast dom html html-parser html5 parser
Last synced: 5 days ago
JSON representation
A super tiny and fast html5 AST parser.
- Host: GitHub
- URL: https://github.com/acrazing/html5parser
- Owner: acrazing
- License: mit
- Created: 2017-08-18T16:05:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:16:50.000Z (almost 2 years ago)
- Last Synced: 2024-03-21T12:50:10.939Z (8 months ago)
- Topics: ast, dom, html, html-parser, html5, parser
- Language: TypeScript
- Homepage:
- Size: 929 KB
- Stars: 170
- Watchers: 4
- Forks: 26
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html5parser
`html5parser` is a super fast and tiny **HTML5** parser.
## Highlights
- **[Fast](#benchmark)**: maybe the fastest one you can find on GitHub.
- **Tiny**: the fully packaged bundle size is less than `5kb`.
- **Cross platform**: works in the modern browsers and Node.js.
- **[HTML5 only](#warnings)**: any thing not in the specification will be ignored.
- **Accurate**: every token could be located in source file.## Table of Contents
- [Installation](#installation)
- [Quick start](#quick-start)
- [API Reference](#api-reference)
- Core
- [tokenize()](#tokenizeinput)
- [parse()](#parseinput)
- Utilities
- [walk()](#walkast-options)
- [safeHtml()](#safehtmlinput)
- [safeHtmlDefaultOptions](#safehtmldefaultoptions)
- [Warnings](#warnings)
- [Benchmark](#benchmark)## Installation
1. Package manager
```bash
npm i -S html5parser# or var yarn
yarn add html5parser
```2. CDN
```html
```## Quick start
[![Edit html5parser - quick start](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/keen-wind-2mpwr?fontsize=14&hidenavigation=1&theme=dark)
```typescript jsx
import { parse, walk, SyntaxKind } from 'html5parser';const ast = parse('Hello html5parser!