0.1.1 • Published 7 years ago

node-outline-audit v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

node-outline-audit

A node wrapper around outline-audit.

Install

npm install node-outline-audit

Usage

Use either of two methods avilable in outline-audit: audit() and parse(), passing in a string of HTML.

audit()

audit() returns a Promise which resolves with an array of warning messages.

const audit = require('node-outline-audit').audit;
const html = `<h1>Example</h1><p>Some string of HTML</p>`;

audit(html).then(warnings => {
  if (warnings.length === 0) {
    console.log('no heading warnings')
  } else {
    warnings.forEach(msg => {
      console.log(msg.message);
    });
  }
});

parse()

parse() returns a Promise which resolves with an object representing the heading outline.

const parse = require('node-outline-audit').parse;
const html = `<h1>Example</h1><p>Some string of HTML</p>`;

parse(html).then(data => {
  console.log(data);
});