Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

chai-htmlhint

1.0.0 • Public • Published

What is chai-htmlhint

chai-htmlhint is a wrapper of htmlhint to use with chai.

How to use it

You just have to pass the html you want to validate like this:

var myhtml = '<h1>my html</h1>';
expect(myhtml).to.be.validHtml;

The default rules are:

{
    "alt-require": true,
    "attr-lowercase": true,
    "attr-no-duplication": true,
    "attr-unsafe-chars": true,
    "attr-value-double-quotes": true,
    "doctype-first": true,
    "doctype-html5": true,
    "id-unique": true,
    "inline-script-disabled": false,
    "inline-style-disabled": false,
    "space-tab-mixed-disabled": true,
    "spec-char-escape": true,
    "src-not-empty": true,
    "style-disabled": true,
    "tag-pair": true,
    "tag-self-close": true,
    "tagname-lowercase": true,
    "title-require": true
};

If you want to override you just need a valid .htmlhintrc file in the root of your project

Install

npm i chai-htmlhint

DownloadsWeekly Downloads

11

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • avatar
  • avatar