Skip to content

Commit

Permalink
Release v0.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jun 26, 2021
1 parent bd3643b commit 63c67e2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion dist/w3c-html-validator.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! W3C HTML Validator v0.7.3 ~ github.com/center-key/w3c-html-validator ~ MIT License
//! W3C HTML Validator v0.7.4 ~ github.com/center-key/w3c-html-validator ~ MIT License

export declare type ValidatorOptions = {
html?: string;
filename?: string;
website?: string;
checkUrl?: string;
ignoreLevel?: 'info' | 'warning';
ignoreMessage?: string | RegExp;
output?: ValidatorResultsOutput;
};
export declare type ValidatorResultsMessage = {
Expand Down
11 changes: 8 additions & 3 deletions dist/w3c-html-validator.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//! W3C HTML Validator v0.7.3 ~ github.com/center-key/w3c-html-validator ~ MIT License
//! W3C HTML Validator v0.7.4 ~ github.com/center-key/w3c-html-validator ~ MIT License

import { readFileSync } from 'fs';
import color from 'ansi-colors';
import log from 'fancy-log';
import request from 'superagent';
const w3cHtmlValidator = {
version: '0.7.3',
version: '0.7.4',
validate(options) {
const defaults = {
checkUrl: 'https://validator.w3.org/nu/',
ignoreLevel: null,
ignoreMessage: null,
output: 'json',
};
const settings = { ...defaults, ...options };
Expand Down Expand Up @@ -40,8 +41,12 @@ const w3cHtmlValidator = {
const filterMessages = (response) => {
const aboveInfo = (subType) => settings.ignoreLevel === 'info' && !!subType;
const aboveIgnoreLevel = (message) => !settings.ignoreLevel || message.type !== 'info' || aboveInfo(message.subType);
const skipSubstr = (title) => typeof settings.ignoreMessage === 'string' && title.includes(settings.ignoreMessage);
const skipRegEx = (title) => settings.ignoreMessage?.constructor.name === 'RegExp' &&
settings.ignoreMessage.test(title);
const isImportant = (message) => aboveIgnoreLevel(message) && !skipSubstr(message.message) && !skipRegEx(message.message);
if (json)
response.body.messages = response.body.messages?.filter(aboveIgnoreLevel) ?? [];
response.body.messages = response.body.messages?.filter(isImportant) ?? [];
return response;
};
const toValidatorResults = (response) => ({
Expand Down
11 changes: 8 additions & 3 deletions dist/w3c-html-validator.umd.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! W3C HTML Validator v0.7.3 ~ github.com/center-key/w3c-html-validator ~ MIT License
//! W3C HTML Validator v0.7.4 ~ github.com/center-key/w3c-html-validator ~ MIT License

var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
Expand All @@ -20,11 +20,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
const fancy_log_1 = __importDefault(require("fancy-log"));
const superagent_1 = __importDefault(require("superagent"));
const w3cHtmlValidator = {
version: '0.7.3',
version: '0.7.4',
validate(options) {
const defaults = {
checkUrl: 'https://validator.w3.org/nu/',
ignoreLevel: null,
ignoreMessage: null,
output: 'json',
};
const settings = { ...defaults, ...options };
Expand Down Expand Up @@ -55,8 +56,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
const filterMessages = (response) => {
const aboveInfo = (subType) => settings.ignoreLevel === 'info' && !!subType;
const aboveIgnoreLevel = (message) => !settings.ignoreLevel || message.type !== 'info' || aboveInfo(message.subType);
const skipSubstr = (title) => typeof settings.ignoreMessage === 'string' && title.includes(settings.ignoreMessage);
const skipRegEx = (title) => settings.ignoreMessage?.constructor.name === 'RegExp' &&
settings.ignoreMessage.test(title);
const isImportant = (message) => aboveIgnoreLevel(message) && !skipSubstr(message.message) && !skipRegEx(message.message);
if (json)
response.body.messages = response.body.messages?.filter(aboveIgnoreLevel) ?? [];
response.body.messages = response.body.messages?.filter(isImportant) ?? [];
return response;
};
const toValidatorResults = (response) => ({
Expand Down
Binary file modified examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "w3c-html-validator",
"version": "0.7.3",
"version": "0.7.4",
"description": "A package for testing HTML files or URLs against the W3C validator (written in TypeScript)",
"license": "MIT",
"type": "module",
Expand Down

0 comments on commit 63c67e2

Please sign in to comment.