How to use the amphtml-validator.newInstance function in amphtml-validator

To help you get started, we’ve selected a few amphtml-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ampproject / ampbench / amp-story / linter / index.ts View on Github external
/// 

import {readFileSync} from "fs";
import {resolve, URL} from "url";
// tslint:disable-next-line:no-var-requires
const validator = require("amphtml-validator").newInstance(
  // Let's not fetch over the network on every run.
  // Use `yarn run update-validator` to update.
  // tslint:disable-next-line:no-var-requires
  readFileSync(`${__dirname}/validator.js`).toString(),
);
import * as cheerio from "cheerio";
import throat = require("throat");

import {default as fetch, Request, RequestInit, Response} from "node-fetch";
import {basename} from "path";
import * as probe from "probe-image-size";
import * as punycode from "punycode";
import * as readline from "readline";

const CONCURRENCY = 8;
const UA_GOOGLEBOT_MOBILE = [
github DefinitelyTyped / DefinitelyTyped / types / amphtml-validator / amphtml-validator-tests.ts View on Github external
(() => {
    const validator = ampHtmlValidator.newInstance("");
    const result = validator.validateString("", "AMP4ADS");
    const { status, errors } = result;
})();

amphtml-validator

Official validator for AMP HTML (www.ampproject.org)

Apache-2.0
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis