Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
amphtml-validator
Advanced tools
This package is published and available at https://www.npmjs.com/package/amphtml-validator.
The amphtml-validator
command line tool is documented here:
https://www.ampproject.org/docs/guides/validate.html#command-line-tool
This API is new and still experimental, 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://www.ampproject.org/docs/reference/spec.html#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://www.ampproject.org/docs/reference/spec.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.
npm install -g amphtml-validator
should now just work.npm install amphtml-validator
(local install) should now work on Windows,
for require('amphtml-validator')
.FAQs
Official validator for AMP HTML (www.ampproject.org)
The npm package amphtml-validator receives a total of 27,222 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.