Comments (3)
Absolutely! PRs are greatly appreciated. And thank you for writing wcag-validator, I referenced it when writing this CLI.
Currently, there is an undocumented API for index.js that is used by cli.js. After running npm install wcag
, you can:
var wcag = require('wcag');
var opts = {
uri: 'http://google.com',
id: 'XXXXXXXXXXXX',
guide: '508'
};
wcag(opts, function(err, report) {
console.log(report);
});
This will print an object with a status, and arrays of errors and potential problems. For example:
{
status: 'FAIL',
errors: [{
line: 38,
column: 4941,
message: 'Img element missing alt attribute.',
solution: 'Add an alt attribute to your img element.'
}],
potentialProblems: [{
line: 1,
column: 175,
message: 'Script may use color alone.',
source: '(function(){window.google={kEI:\'BOBcVbQsgbCxBfvJgZAG\',kEXPI:\'18167,3700330,3700366,4003510,4 ...'
}, {
line: 1,
column: 175,
message: 'Script may cause screen flicker.',
source: '(function(){window.google={kEI:\'BOBcVbQsgbCxBfvJgZAG\',kEXPI:\'18167,3700330,3700366,4003510,4 ...'
}]
}
from node-wcag.
Nice. I'll try to implement this solution in some of my current reports. Fix whatever needed as I go.
I fell completely for your solution when I realised the use of localtunnel quite easily could be hacked to support static files as well :-)
from node-wcag.
I've found the localtunnel implementation to be a little buggy. It might be achecker.ca noticing a lot of requests from localtunnel.me and rate limiting the requests. Something to look out for.
Thanks for the interest and help! 😃
from node-wcag.
Related Issues (20)
- Abort on bad websites HOT 5
- Document the API HOT 1
- Split CLI as separate module HOT 7
- Add "quiet" mode HOT 1
- Parse multiple URLs at once HOT 2
- Check if supplied URL is valid HOT 1
- Change "licenses" metadata in package.json HOT 1
- Update engines to 0.10 HOT 1
- Add multiple versions to .travis.yml
- Error: Unable to connect to undefined HOT 5
- Switch from xml2json to xml2js HOT 1
- Warnings from xmltok dependency on installation HOT 1
- Travis CI failing on `npm install` HOT 2
- Appears to timeout sometimes HOT 4
- Module usage doesn't appear to work with localhost HOT 3
- localhost addresses ignore path and always test homepage HOT 3
- Update changelog
- WCAG failing on empty alt images when there's accompanying text in a link
- No way to obtain an AChecker API ID - is this project alive? HOT 1
- Drop request and use node's built in http? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-wcag.