0.0.2 • Published 8 years ago
rx-htmlparser v0.0.2
RxHTMLParser
RxHTMLParser is a very basic HTML Parser that uses reactive extensions (RxJS).
It transforms an HTML string into an observable source and notifies when it encounters:
- an opening tag
- a closing tag
- void elements
- a text character
Usage
RxHTMLParser is build as a UMD module using webpack.
To install, simply
npm install --save RxHTMLParser
Then you can for instance
// on a server
let rxHTMLParser = require('../dist/rx-htmlparser');
or
// on a client
<script src="rx-htmlparser.js"></script>
then just use it
let sentence = 'this <span class='someclass'>is</span> a text.'
let source = rxHTMLParser(sentence);
let subscription = source.subscribe(
found => { console.log(found) },
err => { console.log(err) },
_ => { console.log('done') });
How to build
Just change the webpack.config.js and gulpfile.js if the default build doesn't suit you.