Git Product home page Git Product logo

Comments (3)

contolini avatar contolini commented on August 19, 2024

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.

zrrrzzt avatar zrrrzzt commented on August 19, 2024

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.

contolini avatar contolini commented on August 19, 2024

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)

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.