{"id":13341438,"url":"https://github.com/a11ywatch/accessibility-rs","last_synced_at":"2025-04-19T17:19:15.060Z","repository":{"id":199068788,"uuid":"702090958","full_name":"a11ywatch/accessibility-rs","owner":"a11ywatch","description":"The web accessibility engine for Rust","archived":false,"fork":false,"pushed_at":"2024-06-26T15:14:41.000Z","size":1419,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T02:05:23.533Z","etag":null,"topics":["accessibility","accessibility-automation","accessibility-testing","rust","wcag","web-accessibility"],"latest_commit_sha":null,"homepage":"https://docs.rs/accessibility-rs/latest/accessibility_rs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a11ywatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE_APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["a11ywatch"]}},"created_at":"2023-10-08T13:22:00.000Z","updated_at":"2024-12-24T21:41:04.000Z","dependencies_parsed_at":"2023-10-14T20:53:00.668Z","dependency_job_id":"188336f0-54a4-44c4-93a4-b9e336c596e4","html_url":"https://github.com/a11ywatch/accessibility-rs","commit_stats":null,"previous_names":["a11ywatch/accessibility-rs"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Faccessibility-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Faccessibility-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Faccessibility-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Faccessibility-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a11ywatch","download_url":"https://codeload.github.com/a11ywatch/accessibility-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249228271,"owners_count":21233852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","accessibility-automation","accessibility-testing","rust","wcag","web-accessibility"],"created_at":"2024-07-29T19:25:26.141Z","updated_at":"2025-04-16T10:31:57.181Z","avatar_url":"https://github.com/a11ywatch.png","language":"Rust","readme":"# accessibility-rs\n\nThe Rust web accessibility engine.\n\n## Usage\n\n```toml\n[dependencies]\naccessibility-rs = \"^0.1\"\n```\n\n```rs\nuse accessibility_rs::{audit, AuditConfig};\n\nfn main() {\n  let html = r###\"\u003chtml lang=\"en\"\u003e\n      \u003cbody\u003e\n          \u003ca href=\"routes.html\"\u003e\n              \u003cimg src=\"topo.gif\"\u003e\n              Golf\n          \u003c/a\u003e\n      \u003c/body\u003e\n  \u003c/html\u003e\"###;\n  let css = \"\";\n  // pass in raw html, optional css, bounding box clips, and locale for audit\n  let audit = accessibility_rs::audit(\u0026AuditConfig::new(\u0026html, \u0026css, false, \"en\"));\n  println!(\"{:?}\", audit);\n}\n```\n\nWith the Tokio runtime.\n\n```toml\n[dependencies]\naccessibility-rs = { version = \"^0.1\", features = [\"tokio\"]}\n```\n\n```rs\nuse accessibility_rs::{audit, AuditConfig};\nuse tokio;\n\n#[tokio::main]\nasync fn main() {\n  let html = r###\"\u003chtml lang=\"en\"\u003e\n      \u003cbody\u003e\n          \u003ca href=\"routes.html\"\u003e\n              \u003cimg src=\"topo.gif\"\u003e\n              Golf\n          \u003c/a\u003e\n      \u003c/body\u003e\n  \u003c/html\u003e\"###;\n  let css = \"\";\n  // pass in raw html, optional css, bounding box clips, and locale for audit\n  let audit = accessibility_rs::audit(\u0026AuditConfig::new(\u0026html, \u0026css, false, \"en\")).await;\n  println!(\"{:?}\", audit);\n}\n```\n\nWith the Spider full website crawling.\n\n```toml\n[dependencies]\naccessibility-rs = { version = \"^0.1\", features = [\"spider\"]}\n```\n\n```rs\nuse accessibility_rs::{audit, AuditConfig};\nuse tokio;\n\n#[tokio::main]\nasync fn main() {\n  let audit = accessibility_rs::audit(\u0026AuditConfig::new_website(\u0026\"https://choosealicense.com\".into())).await;\n  println!(\"{:?}\", audit);\n}\n```\n\nIf you need to use concurrency use TendrilSink.\n\n```rs\nuse accessibility_rs::{fast_html5ever, Auditor, Html};\nuse fast_html5ever::driver::{self, ParseOpts};\nuse tendril::TendrilSink;\n\nlet parser = driver::parse_document(\n    Html::new_document(),\n    ParseOpts::default(),\n);\nlet document = parser.one(\"\u003chtml\u003eMY html code \u003c/html\u003e\");\n\nlet auditor = Auditor::new(\n    \u0026document, \u0026\"\", false, \u0026\"en\",\n);\n\nlet issues =\n    accessibility_rs::engine::audit::wcag::WCAGAAA::audit(auditor)\n        .await;\n```\n\n### Documentation\n\n[Module documentation with examples](https://docs.rs/accessibility-rs).\n\n### Features\n\n1. Accurate web accessibility WCAG audits.\n1. Incredibly fast nanosecond audits.\n1. Ideal shapes for audits that scale.\n1. Shortest path CSS selectors for elements.\n1. i18n support for multiple languages.\n1. Re-creating layout tree to get element position coordinates.\n1. Crawling full websites lightning-fast using [spider](https://github.com/spider-rs/spider).\n1. Low-level built to be used as an engine in browsers.\n\n## [Benchmarks](./benches/)\n\n```sh\naudit-speed/core/audit: small html (4k iterations)\ntime: [55.689 µs 56.246 µs 57.110 µs]\naudit-speed/core/audit: medium html (4k iterations)\ntime: [824.07 µs 830.30 µs 839.37 µs]\naudit-speed/core/audit: large html (4k iterations)\ntime: [1.1206 ms 1.1260 ms 1.1321 ms]\naudit-speed/core/audit: spider audit html (4k iterations)\ntime: [263.33 ms 266.55 ms 269.93 ms]\n```\n\n## Examples\n\n1. [Wasm](https://webassembly.org/) example view [kayle_innate](https://github.com/a11ywatch/kayle/blob/main/kayle_innate/src/lib.rs#L18).\n1. Example integrating with a [headless browser](https://github.com/a11ywatch/kayle/blob/main/kayle/tests/innate.ts#L14).\n\n## Crate Features\n\n1. [tokio](https://docs.rs/tokio/latest/tokio/): Enable tokio async runtime handling. Recommended for high freq server usage.\n1. [rayon](https://docs.rs/rayon/latest/rayon/): Parallelism with rayon. (Expensive test future handling)\n1. [rayon_wasm](https://lib.rs/crates/rayon-wasm): Enable the wasm runtime for rayon.\n1. [spider](https://docs.rs/spider-rs/latest/spider/): Crawl entire websites using spider. Full website audits of 100-1,000 pages within milliseconds.\n\n### Contributing\n\nTo help improve the rules the following needs to be done:\n\n1. Add the [rule](./RULES.md) to the tracking list - you can use the [standards list and mappings here](https://squizlabs.github.io/HTML_CodeSniffer/Standards/WCAG2/) for help.\n1. Add the logic of handling the rule to [wcag_rule_map](./accessibility-rs/src/engine/rules/wcag_rule_map.rs) and the [techniques](./accessibility-rs/src/engine/rules/techniques.rs).\n1. Add [unit](./accessibility-rs/tests/unit/mod.rs) test.\n\n### License\n\nThis project is licensed under either of\n\n- Apache License, Version 2.0, ([LICENSE_APACHE](LICENSE_APACHE) or\n  https://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE_MIT](LICENSE_MIT) or\n  https://opensource.org/licenses/MIT)\n","funding_links":["https://github.com/sponsors/a11ywatch"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa11ywatch%2Faccessibility-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa11ywatch%2Faccessibility-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa11ywatch%2Faccessibility-rs/lists"}