# Getting Started

## Installation

```
npm install @accesslint/core
```

## Browser usage

Add the IIFE build to your page with a script tag:

```
<script src="https://cdn.jsdelivr.net/npm/@accesslint/core/dist/index.iife.js"></script>
<script>
  const result = window.AccessLint.runAudit(document);

for (const v of result.violations) {
    console.log(`[${v.ruleId}] ${v.message}`);
    console.log(`  Selector: ${v.selector}`);
    console.log(`  Impact: ${v.impact}`);
  }
</script>
```

If you’re using a bundler (Vite, webpack, etc.), you can import the ES module directly:

```
import { runAudit } from "@accesslint/core";

const result = runAudit(document);
```

## Headless browser (Playwright)

```
import { chromium } from "playwright";

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto("https://example.com");

// Inject the IIFE build
await page.addScriptTag({ path: "node_modules/@accesslint/core/dist/index.iife.js" });

const violations = await page.evaluate(() => {
  return window.AccessLint.runAudit(document).violations.map((v) => ({
    ruleId: v.ruleId,
    message: v.message,
    selector: v.selector,
    impact: v.impact,
  }));
});

console.log(violations);
await browser.close();
```

## Server-side DOM (happy-dom)

```
import { Window } from "happy-dom";
import { runAudit } from "@accesslint/core";

const window = new Window();
window.document.write(`
  <!DOCTYPE html>
  <html lang="en">
    <head><title>Test</title></head>
    <body><img src="photo.jpg"></body>
  </html>
`);

const result = runAudit(window.document);
// result.violations → [{ ruleId: "accesslint-011", message: "Images must have alternate text..." }]
```

## Configuration

Disable specific rules:

```
import { configureRules, runAudit } from "@accesslint/core";

configureRules({ disabled: ["accesslint-033"] }); // disable heading-order
const result = runAudit(document);
```

## What’s next

- [API Reference](/content/core/docs/api-reference/index.html) — full function and type documentation
- [Rules](/content/core/docs/rules/index.html) — all rules with WCAG mapping
- [Benchmarks](/content/core/benches/index.html) — performance and accuracy data
