Gathering detailed insights and metrics for amphtml-validator
Gathering detailed insights and metrics for amphtml-validator
Gathering detailed insights and metrics for amphtml-validator
Gathering detailed insights and metrics for amphtml-validator
@types/amphtml-validator
TypeScript definitions for amphtml-validator
amphtml-validator-extra
Enhanced package of amphtml-validator.
gulp-amphtml-validator
Gulp plugin for the official AMP HTML validator (www.ampproject.org)
amphtml-validator-rules
Get all the rules that the `amphtml-validator` uses.
The AMP web component framework.
npm install amphtml-validator
Typescript
Module System
Node Version
NPM Version
97.3
Supply Chain
99.5
Quality
75.7
Maintenance
100
Vulnerability
100
License
JavaScript (79.93%)
HTML (9.1%)
C++ (7.54%)
CSS (2.22%)
TypeScript (0.55%)
Python (0.28%)
Starlark (0.15%)
Yacc (0.12%)
Shell (0.08%)
Go (0.03%)
Total Downloads
29,837,727
Last Day
2,853
Last Week
36,830
Last Month
143,333
Last Year
1,546,101
Apache-2.0 License
14,896 Stars
22,565 Commits
3,947 Forks
626 Watchers
174 Branches
1,173 Contributors
Updated on Jul 01, 2025
Minified
Minified + Gzipped
Latest Version
1.0.38
Package Id
amphtml-validator@1.0.38
Unpacked Size
30.75 kB
Size
8.61 kB
File Count
5
NPM Version
10.3.0
Node Version
20.11.0
Published on
Apr 02, 2024
Cumulative downloads
Total Downloads
Last Day
47.1%
2,853
Compared to previous day
Last Week
2.8%
36,830
Compared to previous week
Last Month
0.1%
143,333
Compared to previous month
Last Year
-30.7%
1,546,101
Compared to previous year
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/main/validator/js/nodejs.
The amphtml-validator
command line tool is documented here:
https://amp.dev/documentation/guides-and-tutorials/learn/validation-workflow/validate_amp#command-line-tool
This API is new - feedback is especially welcome.
To install, use npm install amphtml-validator
in your project directory,
or add amphtml-validator
as a dependency to your package.json.
You may save the following example into a file, e.g., demo.js
.
1'use strict'; 2var amphtmlValidator = require('amphtml-validator'); 3 4amphtmlValidator.getInstance().then(function (validator) { 5 var result = validator.validateString('<html>Hello, world.</html>'); 6 (result.status === 'PASS' ? console.log : console.error)(result.status); 7 for (var ii = 0; ii < result.errors.length; ii++) { 8 var error = result.errors[ii]; 9 var msg = 10 'line ' + error.line + ', col ' + error.col + ': ' + error.message; 11 if (error.specUrl !== null) { 12 msg += ' (see ' + error.specUrl + ')'; 13 } 14 (error.severity === 'ERROR' ? console.error : console.warn)(msg); 15 } 16});
Now try running it:
1$ node demo.js 2FAIL 3line 1, col 0: The mandatory attribute '⚡' is missing in tag 'html ⚡ for top-level html'. (see https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml#required-markup) 4line 1, col 0: The parent tag of tag 'html ⚡ for top-level html' is '$root', but it can only be '!doctype'. (see https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml.html#required-markup) 5...
As expected, this emits errors because the provided string in the example, <html>Hello, world.</html>
is not a valid AMP HTML document.
The method validateString
also takes a htmlFormat
parameter which
would allow applying the validator rules for AMP4ADS
or AMP4EMAIL
as well. `validateString(inputString, htmlFormat).
1/** 2 * Validates the provided inputString; the htmlFormat can be 'AMP' or 3 * 'AMP4ADS'; it defaults to 'AMP' if not specified. 4 * @param {string} inputString 5 * @param {string=} htmlFormat 6 * @return {!ValidationResult} 7 * @export 8 */
https://cdn.ampproject.org/v0/validator_wasm.js
.
ampproject/amphtml #34213colors
dependency version (ampproject/amphtml #31656).npm install amphtml-validator
(local install) should now work on Windows,
for require('amphtml-validator')
.npm install -g amphtml-validator
should now just work.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
30 out of 30 merged PRs checked by a CI test -- score normalized to 10
Reason
all changesets reviewed
Reason
project has 17 contributing companies or organizations
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
project is fuzzed
Details
Reason
license file detected
Details
Reason
16 commit(s) and 12 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
52 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30T14:24:59Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More