• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    JavaScript
  • License
    The Unlicense
  • Created over 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A npm package for testing files or url's again the wc3 validator

Build Status Dependencies

w3cjs

A node.js library for testing files or url's against the w3c html validator.

Installation

npm install w3cjs

Usage

var w3cjs = require('w3cjs');

var results = w3cjs.validate({
	file: 'demo.html', // file can either be a local file or a remote file
	//file: 'http://html5boilerplate.com/',
	//input: '<html>...</html>',
	//input: myBuffer,
	output: 'json', // Defaults to 'json', other option includes html
	//proxy: 'http://proxy:8080', // Default to null
	callback: function (err, res) {
		console.log(res);
		// depending on the output type, res will either be a json object or a html string
	}
});

Example async testing with Mocha

var w3cjs = require('w3cjs');
describe('html validation', function(){
	it('index page should have no html errors', function(done){
		w3cjs.validate({
			file: 'index.html',
			callback: function (error, res) {
				console.log(error || res);
				if (res && res.messages.length > 0 ) {
					throw {error: 'html errors have been found', results: res};
				};
				done();
			}
		})
	})
})

Older versions < 0.2.0

w3c has changed their validator API to not include some old options. It will eventually be fully deprecated and everyone is advised to update to 0.3.0 of this module.

doctype: 'HTML5', // Defaults false for autodetect
charset: 'utf-8', // Defaults false for autodetect

More Repositories

1

backbonetutorials

As single page apps and large scale javascript applications become more prominent on the web, useful resources for those developers who are jumping the ship are crucial.
JavaScript
2,303
star
2

kaleistyleguide

This project aims at making sure your style sheets are fully documented whilst being synchronized with your webpages styles. To do this it actually uses your live stylesheets in so that at anytime you can review how your styleguide looks.
JavaScript
671
star
3

backboneboilerplate

The project aims at being a modular backbone environment with as little authority on development as possible such that developers can innovate and contribute in an attempt to mimic the success of backbone.js ambiguous nature.
JavaScript
569
star
4

blockbid-ccxt-tutorials

Helping our users understand how to trade programatically.
JavaScript
381
star
5

seoserver

SEO Server is a command line tool that runs a server that allows GoogleBot, as well as other crawlers, to crawl Javascript heavy websites.
JavaScript
218
star
6

thomasdavis.github.io

Technical Tips generally about backbone.js,node.js and couchdb
CSS
87
star
7

omega

clubhouse + google deep voice + gpt3
JavaScript
40
star
8

pinjs

Pinjs is an node.js API client for Pin which is an Australian payment gateway.
JavaScript
25
star
9

saveprivacy

Signups for Australian campaign against Mass Surveillance
CSS
13
star
10

resume

Resume of Thomas Davis
9
star
11

video-backbone-beginner-server

JavaScript
8
star
12

markdownresume

Markdown Resume
JavaScript
8
star
13

react-redux-tutorials

HTML
7
star
14

gitgossip

Place holder for gitgossip.com which will be open sourced soon.
7
star
15

chess

api
JavaScript
5
star
16

jQuery-Social-Sidebar

A jQuery plugin that
JavaScript
5
star
17

browser-node-slides

Running node.js in the browser
JavaScript
5
star
18

jQuery-DataTables-Backbone

Manipulate a DataTable using BackBone.js
5
star
19

boilerplate

mm
JavaScript
4
star
20

CDN-Js-Website

Frontend
JavaScript
4
star
21

backbone-workshop-client

Client repo
JavaScript
4
star
22

styleguide

JavaScript
4
star
23

ancient-greek-tutorials

by http://www.reddit.com/user/Nanocyborgasm
4
star
24

old-facebook

Old submission for Facebook application
JavaScript
3
star
25

thomasdav.is

my new home page
CSS
3
star
26

ancient-greek

JavaScript
3
star
27

philo

philo = love of
JavaScript
3
star
28

bob

bob
JavaScript
3
star
29

Wordpress-Social-Sidebar

A Wordpress plugin enabling jQuery plugin Social Sidebar
PHP
3
star
30

jsonresume-theme-techlead

A theme inspired by Techlead (millionaire) https://youtu.be/xpaz7nrNmXA?t=528
HTML
3
star
31

brendandyer

Brendan Dyers Thoughts
3
star
32

backbone-workshop-server

Backbone server
JavaScript
3
star
33

islandbreeze

JavaScript
3
star
34

amazon-caching-demo-with-node.js

A demo for how to use amazons dynamic caching. used at bris js august 2012
3
star
35

backbone-and-couch

A example application to help people learn easy ways to make the two work together.
3
star
36

resetthenet-cloudflare-app

Cloudflare App for Reset The Net
JavaScript
3
star
37

white

UI components for some stuff
2
star
38

living

JavaScript
2
star
39

dickbird

2
star
40

cyclone-yasi

blue
2
star
41

ciara

2
star
42

tarshadavis.com

my sisters websitee
2
star
43

workplease

asd
JavaScript
2
star
44

cpricelandscapes

JavaScript
2
star
45

sittella

2
star
46

UMD-Sample-Project

To compile or not to compile that is the question
2
star
47

ecortes.net

2
star
48

blackshatan

2
star
49

skipchimp

Bypass MailChimp opt in process by using the API
JavaScript
2
star
50

whatwedo

asd
JavaScript
2
star
51

anki-riak

learning ancient greek the easy way
2
star
52

joeslawnscaping

Website for joe
JavaScript
2
star
53

btwb.js

Beyond The Whiteboard API Client
2
star
54

anki-web

2
star
55

altproducts

JavaScript
2
star
56

green

2
star
57

antwonthedon.com

Antwon, born Anthony Murray, is a young Aboriginal rap artist from Mildura Australia. His first album " The Aboriginal Criminal " was released on iTunes in 2009 under his own label CME Criminal Minded Entertainment.
2
star
58

world-db-postgres

Use this to upload to postgres esp heroku. never lose this so annoying to find
2
star
59

productscript

1
star
60

thomasdavis

1
star
61

requirejs-delights

A presentation on require.js as module system and a loader
1
star
62

jspurf

JavaScript
1
star
63

ajaxdavis.com

I like this name
1
star
64

asda

1
star
65

testingjsonblog

HTML
1
star
66

homepage

My personal homepage and blog
CSS
1
star
67

fawziyah.com

HTML
1
star
68

impossible

modern application building conventions
1
star
69

jsonblog-cli

JavaScript
1
star
70

roarrecruitment.com.au

a
CSS
1
star
71

rolandnsharp

1
star
72

mushroomvoice

1
star
73

tarshaart

1
star
74

dotavoid

1
star
75

opendesertdreams.github.io

HTML
1
star
76

todo-backbone-requirejs

A todo app
1
star
77

covidcalc

JavaScript
1
star
78

mecaptureyou

JavaScript
1
star
79

ineedto

CSS
1
star
80

roarrecruitment

JavaScript
1
star
81

jquery-plugin-pattern

In progress
1
star
82

lordajax.com

Built with github.com/jsonblog
HTML
1
star
83

somejs

somejs
1
star
84

shout-ubuntu

shout irc for ubuntu
1
star
85

corsgithub

A cors proxy server for raw.github.com
JavaScript
1
star
86

eed

example docs
CSS
1
star
87

dummyjaresumesite

1
star
88

ideas

1
star
89

jsonblog-generator-boilerplate

An example generator for people to learn how to construct generators
JavaScript
1
star
90

bb-whitepaper

1
star
91

sad

1
star
92

sibyelleruppert

HTML
1
star
93

jsonresume-theme-professional

1
star
94

recommend

1
star
95

ajaxdavis

HTML
1
star
96

privacy-pack

privacy pack website
CSS
1
star
97

artgallery

JavaScript
1
star