Official validator for AMP HTML (www.ampproject.org)
This package is published and available at https://www.npmjs.com/package/amphtml-validator.
The source code is available at https://github.com/ampproject/amphtml/tree/master/validator/nodejs.
amphtml-validator command line tool is documented here:
This API is new - feedback is especially welcome.
To install, use
npm install amphtml-validator in your project directory,
amphtml-validator as a dependency to your package.json.
You may save the following example into a file, e.g.,
'use strict';var amphtmlValidator = ;amphtmlValidator;
Now try running it:
$ node demo.jsFAILline 1, col 0: The mandatory attribute '⚡' is missing in tag 'html ⚡ for top-level html'. (see )line 1, col 0: The parent tag of tag 'html ⚡ for top-level html' is '$root', but it can only be '!doctype'. (see )...
As expected, this emits errors because the provided string in the example,
<html>Hello, world.</html> is not a valid AMP HTML document.
npm install -g amphtml-validatorshould now just work.
npm install amphtml-validator(local install) should now work on Windows, for