Package Exports
- html-validator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-validator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
A Node.js module/CLI app for validating html using validator.nu
##Module Supports the following modes from Validator.nu Web Service Interface
- Document URL as a GET parameter; the service retrieves the document by URL over HTTP or HTTPS.
- Document POSTed as the HTTP entity body; parameters in query string as with GET.
###Installation
$ npm install html-validator
###Test
$ npm test
###Usage
Create an options object.
format This is the formatting of the returned data and it is required. It supports json, html, xhtml, xml, gnu and text.
url The url to the page you want to validate.
var validator = require('html-validator')
, opts = {
url : 'http://url-to-validate.com',
format : 'json'
};
validator(opts, function(err, data){
if(err) throw err;
console.log(data);
});
data The html you want to validate
var validator = require('html-validator')
, fs = require('fs')
, opts = {
format : 'json'
};
fs.readFile( 'file-to-validate.html', 'utf8', function( err, html ) {
if (err) throw err;
opts.data = html;
validator(opts, function(err, data){
if(err) throw err;
console.log(data);
});
});
##CLI
Pass in --url or --file and optional --format.
###Installation
Install globally
$ npm install html-validator -g
###Usage
With url
$ html-validator http://url-to-validate
With file
$ html-validator --file=path-to-file
Optional pass in format for returned data.
Valid options: json, html, xhtml, xml, gnu and text (default).
$ html-validator http://url-to-validate --format=gnu