Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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!