0.16.0 • Published 7 years ago
html-auditor v0.16.0
A NodeJS CLI tool to fetch and audit HTML pages for web accessibility (WCAG2), HTML5 and link validation.
Installation
npm install -g html-auditor
Retreive HTML
HTML Fetch
html-audit fetch
: fetch HTML pages from an XML sitemap or individual HTML page.
Options
--help
(optional) - Display help text--uri
(required) - path or URL to XML Sitemap file--dir
(required) - directory to output HTML files--map
(required when --lastmod is provided) - file to output JSON that maps file names to URLs and modified files. If not set, sends to stdout--lastmod
(optional) - Date for downloading last modified content
Example
html-audit fetch --uri https://www.washingtonpost.com/web-national-sitemap.xml --dir ./html-pages
Audit HTML
1. Accessibility audit (WCAG)
html-audit a11y
: audit HTML pages for accessibility issues.
Options
--help
(optional) - Display help text.--path [path / file]
(required) - path to HTML files or an HTML file to audit--standard [standard]
(default:WCAG2AA
) - Accessibility standard as per pa11y--report [path]
- path to output JSON audit report--ignore [types]
- types to ignore separated by semi-colons (notice;warning
)--map
(required when --lastmod is provided) - JSON map file which holds modified files data--lastmod
(optional) - Scan last modified files
Example
html-audit a11y --path ./html-pages --report ./report --standard WCAG2AA --ignore 'notice;warning'
2. HTML5 validation audit
html-audit html5
: audit HTML pages for HTML5 validation issues.
Options
--help
(optional) - Display help text--path [path / file]
(required) - path to HTML files or an HTML file to audit--report [path]
- path to output JSON audit report--errors-only
- only report errors (no notices or warnings)--map
(required when --lastmod is provided) - JSON map file which holds modified files data--lastmod
(optional) - Scan last modified files--validator
(optional) - Manually specify validator service
Example
html-audit html5 --path ./html-pages --report ./report --errors-only
3. Link audit
html-audit link
: audit HTML pages for link issues.
Options
--help
(optional) - Display help text--path [path / file]
(required) - path to HTML files or an HTML file to audit--base-uri
(required) - the base URL of the site being audited--report [path]
- path to output JSON audit report--report-verbose
- verbose report--map
(required when --lastmod is provided) - JSON map file which holds modified files data.--lastmod
(optional) - Scan last modified files
Example
html-audit link --path ./html-pages --report ./report --base-uri http://example.com --report-verbose
Development
Code Standards
# Run code standard review
npm run eslint
Test
npm run test