Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nerdlabs/fast-html
Blazing fast sax-style HTML parser
https://github.com/nerdlabs/fast-html
Last synced: 27 days ago
JSON representation
Blazing fast sax-style HTML parser
- Host: GitHub
- URL: https://github.com/nerdlabs/fast-html
- Owner: nerdlabs
- Created: 2014-10-03T22:45:10.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-01T12:21:21.000Z (over 7 years ago)
- Last Synced: 2024-11-01T19:36:17.568Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://nerdlabs.github.io/fast-html/docs/index.html
- Size: 68.4 KB
- Stars: 6
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-blazingly-fast - fast-html - Blazing fast sax-style HTML parser (JavaScript)
README
# fast-html [![Build Status][3]][4] [![Coverage Status][5]][6]
fast-html is a sax-style HTML parser focused on performance. It only copes with sane HTML - see the [Things that break](#things-that-break) section.## Install
```shell
npm install --save fast-html
```## Docs
[Test-documentation][7] generated with [mocha's][8] "doc" reporter.## Usage
```js
var fastHtml = require('fast-html')({ parseAttributes: true });// Receive start tags
fastHtml.on('start', function(tagName, attributes){});
// Receive text nodes
fastHtml.on('data', function(text){});
// Receive end tags
fastHtml.on('end', function(tagName)) {});
// Release the hounds
fastHtml.parse('
- Hello World
```
### Things that break
FastHTML is designed for maximum performance, therefore it will not
* Try to fix broken markup
* Try to fix slightly broken markup
* Try to do automagic closing stuff
* Be graceful about unescaped HTML strings in inline `script`, `style` and HTML attributes
#### Solutions
* `` strings in inline `script` - Use ``.
* HTML strings in attributes - Escape them.
[3]: https://img.shields.io/travis/nerdlabs/fast-html.svg
[4]: https://travis-ci.org/nerdlabs/fast-html
[5]: https://img.shields.io/coveralls/nerdlabs/fast-html.svg
[6]: https://coveralls.io/r/nerdlabs/fast-html
[7]: http://nerdlabs.github.io/fast-html/docs/
[8]: http://mochajs.org/