Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including whacko with all npm packages installed. Try it out:

var whacko = require("whacko")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

whacko v0.19.1

Cheerio (http://cheeriojs.github.io/cheerio/) fork that uses parse5 HTML-parser (https://github.com/inikulin/parse5) as an underlying platform

Whacko

Build Status npm

Whacko is a fork of cheerio that uses parse5 as an underlying platform.

Install

$ npm install whacko

API

Difference with cheerio:

  • Use $.load(content) to load HTML documents (e.g. missing <html> tags will be automatically emitted in this case).
  • Use $(content) to create HTML-fragments which can be later added to the loaded document.
  • Parser options (e.g. xmlMode and normalizeWhitespace) are missing since whacko is intended for spec compliant HTML parsing.
  • New parser option encodeEntities added. When false, it disables HTML entities decoding on serialization.
  • New parser option decodeHtmlEntities added. When false, it disables HTML entities decoding on parse.

In all other aspects it is the same with the cheerio API.

Questions or suggestions?

If you have any questions, please feel free to create an issue here on github.

Author

Ivan Nikulin (ifaaan@gmail.com)

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free