Giter Site home page Giter Site logo

nu-html-checker-cli's Introduction

nu-html-checker

A CLI interface for the Nu HTML Checker

Install

% npm install -g nu-html-checker

CLI


  Usage: cli [options] <files/urls ...>

  Options:

    -h, --help                   output usage information
    -V, --version                output the version number
    -f, --formatter <formatter>  Choose the formatter to use. (stylish, json)

API

var checker = require('nu-html-checker');

var batch = checker.validate([ 'test.html', 'http://google.com' ]);

batch.on('progress', function (e) {
  console.log(checker.format('stylish', e.value), '\n');
});

batch.on('end', function (err) {
  if (err) console.error(err.stack);
})

checker.validate(list, options)

When list is an array of strings, they can be either URLs or file paths. They will all be processed in parallel.

If list is supplied as anything else, (such as a string, stream or buffer) it will be validated as an individual item.

Available options:

  • api String The root URL for the endpoint to use (default: https://validator.nu/)
  • level Boolean If set to false, then all messages will be returned (default: only errors)
  • formatter String Must correspond to a named formatter (see below)

Returns

The object returned is an instance of Batch which needs to be interacted with directly. You must at least call batch.end(callback), but you can optionally add a batch.on('progress') handler.

checker.format(name, results)

Formats the given results with the formatter matching the given name. (can either be "stylish" or "json")

stylish (default)

Formats as colored terminal text.

json

Formats as pretty-printed JSON.

nu-html-checker-cli's People

Contributors

dominicbarnes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.