#audit #web #web-page #html #engine #web-accessibility

accessibility-rs

Web accessibility engine for Rust

71 releases

0.1.7 Jun 26, 2024
0.1.6 Jun 26, 2024
0.0.64 Jun 26, 2024
0.0.62 Mar 29, 2024
0.0.44 Oct 23, 2023

#47 in Accessibility

Download history 62/week @ 2024-07-20 130/week @ 2024-07-27 13/week @ 2024-08-03 30/week @ 2024-08-10 15/week @ 2024-08-17 41/week @ 2024-08-24 31/week @ 2024-08-31 20/week @ 2024-09-07 15/week @ 2024-09-14 127/week @ 2024-09-21 68/week @ 2024-09-28 76/week @ 2024-10-05 20/week @ 2024-10-12 50/week @ 2024-10-19 19/week @ 2024-10-26 49/week @ 2024-11-02

140 downloads per month

MIT/Apache

580KB
9K SLoC

Audit html to see how it complies with WCAG standards.

accessibility-rs is a web accessibility engine that can replicate websites without a browser to get complex accessibility reports.

How to use accessibility-rs

There are a couple of ways to use accessibility-rs:

  • Audit perform an audit against an html page.
    • audit is used to audit a web page for issues.

Examples

A basic WCAG audit for a website:

use accessibility_rs::{audit, AuditConfig};

#[cfg(not(feature = "tokio"))]
fn main() {
    let config = AuditConfig::basic(r###"<html><body><h1>My Title</h1><input type="text" placeholder="Type me"></input><img src="tabby_cat.png"></img></body></html>"###);
    let audit = audit(config);
    println!("{:?}", audit);
}

#[cfg(all(feature = "tokio", not(feature = "spider")))]
#[tokio::main]
async fn main() {
    let config = AuditConfig::basic(r###"<html><body><h1>My Title</h1><input type="text" placeholder="Type me"></input><img src="tabby_cat.png"></img></body></html>"###);
    let audit = audit(config).await;
    println!("{:?}", audit);
}

#[cfg(feature = "spider")]
#[tokio::main]
async fn main() {
    let mut config = AuditConfig::default();
    config.url = "https://example.com".into();
    let audit = audit(config).await;
    println!("{:?}", audit);
}

Dependencies

~15–36MB
~588K SLoC