<commit_before>[![Build Status](https://travis-ci.org/zrrrzzt/html-validator-cli.svg?branch=master)](https://travis-ci.org/zrrrzzt/html-validator-cli)
[![Coverage Status](https://coveralls.io/repos/zrrrzzt/html-validator-cli/badge.svg?branch=master&service=github)](https://coveralls.io/github/zrrrzzt/html-validator-cli?branch=master)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

# html-validator-cli

CLI for validating html using [validator.w3.org/nu](http://validator.w3.org/nu/)

Sends ```Page is valid```to ```STDOUT``` and exits with code 0 if page is valid.

Sends ```Page is not valid``` to ```STDOUT``` and exits with code 1 if page is not valid.

## Installation

```
$ npm i html-validator-cli -g
```

## Usage

```
$ html-validator <url>
```

With file

```
$ html-validator --file=<path-to-file>
```

With data

```
$ html-validator --data=data
```

Optional pass in format for returned data.

Valid options: json, html, xhtml, xml, gnu and text (default).

```
$ html-validator <url> --format=gnu
```

Optional pass in another validator.

It needs to expose the same REST interface.

```
$ html-validator <url> --validator='http://html5.validator.nu'
```

Optional pass in strings to ignore

```
$ html-validator <url> --ignore='Error: Stray end tag “div”.' --ignore='Error: Stray end tag “body”.'
```

To get full result from validator use --verbose

```
$ html-validator <url> --verbose
```

Optional, only get errors use --quiet

```
$ html-validator <url> --quiet
```

returns array of error messages

```JavaScript
[
  {<commit_msg>Update Readme with instructions to pass in headers<commit_after>[![Build Status](https://travis-ci.org/zrrrzzt/html-validator-cli.svg?branch=master)](https://travis-ci.org/zrrrzzt/html-validator-cli)
[![Coverage Status](https://coveralls.io/repos/zrrrzzt/html-validator-cli/badge.svg?branch=master&service=github)](https://coveralls.io/github/zrrrzzt/html-validator-cli?branch=master)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

# html-validator-cli

CLI for validating html using [validator.w3.org/nu](http://validator.w3.org/nu/)

Sends ```Page is valid```to ```STDOUT``` and exits with code 0 if page is valid.

Sends ```Page is not valid``` to ```STDOUT``` and exits with code 1 if page is not valid.

## Installation

```
$ npm i html-validator-cli -g
```

## Usage

```
$ html-validator <url>
```

With file

```
$ html-validator --file=<path-to-file>
```

With data

```
$ html-validator --data=data
```

Optional pass in format for returned data.

Valid options: json, html, xhtml, xml, gnu and text (default).

```
$ html-validator <url> --format=gnu
```

Optional pass in another validator.

It needs to expose the same REST interface.

```
$ html-validator <url> --validator='http://html5.validator.nu'
```

Optional pass in strings to ignore

```
$ html-validator <url> --ignore='Error: Stray end tag “div”.' --ignore='Error: Stray end tag “body”.'
```
Optional pass in headers

```
$ html-validator <url> --headers='{"foo":"doo"}'
```

To get full result from validator use --verbose

```
$ html-validator <url> --verbose
```

Optional, only get errors use --quiet

```
$ html-validator <url> --quiet
```

returns array of error messages

```JavaScript
[
  {
{'fraction_non_alphanumeric': 0.18053927315357562, 'fraction_numerical': 0.004103165298944901, 'mean_word_length': 4.400316455696203, 'pattern_counts': {'":': 1, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3537011', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1185, 'n_words': 292}