Offline html5 validator
Homepage Repository npm Download
npm install html-validate@9.5.3
Offline HTML5 validator. Validates either a full document or a smaller (incomplete) template, e.g. from an AngularJS or Vue.js component.
npm install -g html-validate
html-validate FILENAME..
Create .htmlvalidate.json
:
{
"extends": [
"htmlvalidate:recommended"
],
"rules": {
"close-order": "error"
"void": ["warn", {"style": "omit"}]
}
}
<p>
<button>Click me!</button>
<div id="show-me">
Lorem ipsum
</div>
</p>
1:1 error Element <p> is implicitly closed by adjacent <div> no-implicit-close
2:2 error Button is missing type attribute button-type
6:4 error Unexpected close-tag, expected opening tag close-order
Testing is done using jest.
npm test
or call jest
directly.
Some tests are autogenerated from documentation examples, use npm run build:docs
to build those before running.
Linting is done using ESLint.
npm run eslint
or call eslint
directly.
npm run build
To build documentation use:
npm run build:docs
The documentation can be served locally using:
npm start