![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
amphtml-validator
Advanced tools
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
.
'use strict';
var amphtmlValidator = require('amphtml-validator');
amphtmlValidator.getInstance().then(function (validator) {
var result = validator.validateString('<html>Hello, world.</html>');
(result.status === 'PASS' ? console.log : console.error)(result.status);
for (var ii = 0; ii < result.errors.length; ii++) {
var error = result.errors[ii];
var msg =
'line ' + error.line + ', col ' + error.col + ': ' + error.message;
if (error.specUrl !== null) {
msg += ' (see ' + error.specUrl + ')';
}
(error.severity === 'ERROR' ? console.error : console.warn)(msg);
}
});
Now try running it:
$ node demo.js
FAIL
line 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)
line 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)
...
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).
/**
* Validates the provided inputString; the htmlFormat can be 'AMP' or
* 'AMP4ADS'; it defaults to 'AMP' if not specified.
* @param {string} inputString
* @param {string=} htmlFormat
* @return {!ValidationResult}
* @export
*/
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.FAQs
Official validator for AMP HTML (www.ampproject.org)
The npm package amphtml-validator receives a total of 16,191 weekly downloads. As such, amphtml-validator popularity was classified as popular.
We found that amphtml-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.