Fast & forgiving HTML/Svelte/XML/RSS parser
npm install htmlparser2-svelte
!Build Status
A forgiving HTML/Svelte/XML/RSS parser.
The parser can handle streams and provides a callback interface.
Extended version of htmlparser2 with Svelte syntax feature supporting, enabled by new options.
- Support of JS expressions in tag attributes
``html`
npm install htmlparser2-svelte
`javascript
const htmlparser2 = require("htmlparser2-svelte");
const parser = new htmlparser2.Parser(
{
onopentag(name, attribs) {
if (name === "script" && attribs.type === "text/javascript") {
console.log("JS! Hooray!");
}
},
ontext(text) {
console.log("-->", text);
},
onclosetag(tagname) {
if (tagname === "script") {
console.log("That's it?!");
}
},
},
{ decodeEntities: true }
);
parser.write(
"Xyz