Skip to main content

AI-powered WCAG 2.1 AA document accessibility checker and fixer — built on pandoc and Claude

Project description

altscribe

CI PyPI Python 3.10+ Code style: black Linting: ruff License: MIT

AI-powered WCAG 2.1 AA document accessibility checker and fixer — built on pandoc and Claude.

Designed for California State University faculty to meet accessibility obligations under ADA Title II, Section 508, and the CSU Accessible Technology Initiative.

Features

Accessibility Checks

Check WCAG SC Detects Auto-fix
Image Alt-Text 1.1.1, 1.4.5 Missing/inadequate alt-text on images AI-generated alt-text by image type
Heading Hierarchy 1.3.1, 2.4.6 Missing H1, skipped levels, empty headings, fake headings (bold paragraphs) Re-levels headings, promotes fake headings
Link Text Quality 2.4.4 "Click here", bare URLs, empty links, duplicate text with different URLs AI-suggested descriptive replacements
Table Accessibility 1.3.1 Missing captions, empty table headers AI-generated captions
Document Language 3.1.1 Missing lang attribute Auto-detects language via langdetect
List Structure 1.3.1 Fake lists (bullet/numbered paragraphs not using list markup) Converts to proper list elements

Core Capabilities

  • Automatic image classification — detects decorative, informative, functional, complex, and text images per the W3C WAI Images Tutorial
  • Check-only mode — report issues without making changes or API calls (--check)
  • Selective checks — enable/disable individual checks (--enable, --disable)
  • Context-aware AI — passes surrounding text and section headings to Claude for better descriptions
  • Complex image support — generates both short alt-text and structured long descriptions for charts, graphs, and diagrams
  • Any format in, any format out — leverages pandoc to read and write Markdown, HTML, DOCX, RST, LaTeX, and more

Installation

Prerequisites

Install from PyPI

pip install altscribe

# With automatic language detection (for document-language check)
pip install altscribe[language]

Install from source

git clone https://github.com/ahb-sjsu/altscribe.git
cd altscribe
pip install -e .

Usage

# Set your API key (or pass --api-key)
export ANTHROPIC_API_KEY=sk-ant-...

# Fix all accessibility issues in a Markdown file
altscribe lecture-notes.md -o lecture-notes-accessible.md

# Check only — report issues without fixing (no API calls, free)
altscribe --check lecture-notes.md

# Run only specific checks
altscribe --enable heading-hierarchy --enable link-text --check doc.md

# Skip certain checks
altscribe --disable image-alt-text doc.md -o fixed.md

# Convert HTML to accessible Markdown
altscribe syllabus.html -f html -t markdown -o syllabus.md

# Regenerate alt-text even for images that already have it
altscribe slides.md --overwrite -o slides-fixed.md

Options

Flag Description
-o, --output FILE Output file path (default: stdout)
-f, --from FORMAT Pandoc input format (default: auto-detect)
-t, --to FORMAT Pandoc output format (default: markdown)
--api-key KEY Anthropic API key (or set ANTHROPIC_API_KEY). Only required in fix mode.
--overwrite Regenerate alt-text for images that already have it
--check Report-only mode — no fixes, no API calls. Exit code 1 if issues found.
--enable ID Only run specific check(s). Repeatable.
--disable ID Skip specific check(s). Repeatable.

Available Check IDs

image-alt-text, heading-hierarchy, link-text, table-accessibility, document-language, list-structure

How It Works

  1. Parse — reads the input document into a pandoc AST via panflute
  2. Walk — traverses the AST once, dispatching each element to registered checkers (headings, images, links, tables, lists, etc.)
  3. Analyze — each checker accumulates issues: missing alt-text, skipped heading levels, generic link text, fake lists, and more
  4. Fix (unless --check) — checkers apply auto-fixes: AI-generated alt-text, re-leveled headings, proper list markup, language tags
  5. Report — prints a summary of all issues found and fixed to stderr
  6. Output — writes the modified document in any pandoc-supported format

Compliance

altscribe is designed to satisfy the following standards as they apply to CSU:

Regulation Standard Deadline
ADA Title II (2024 Final Rule) WCAG 2.1 Level AA April 24, 2026
Section 508 (Revised 2017) WCAG 2.0 Level AA Ongoing
California Gov. Code 11135 Section 508 compliance Ongoing
California AB 434 WCAG 2.0 Level AA+ Biennial
CSU Executive Order 1111 CSU ATI Policy Ongoing

WCAG success criteria addressed

  • 1.1.1 Non-text Content (Level A) — all images receive appropriate text alternatives
  • 1.3.1 Info and Relationships (Level A) — headings, tables, and lists use proper semantic markup
  • 1.4.5 Images of Text (Level AA) — text in images is transcribed verbatim
  • 2.4.4 Link Purpose (Level A) — link text is descriptive and non-generic
  • 2.4.6 Headings and Labels (Level AA) — heading hierarchy is logical and complete
  • 3.1.1 Language of Page (Level A) — document language attribute is present

Image handling per W3C WAI guidelines

Image type alt-text strategy Long description
Decorative alt="" No
Informative Concise description No
Functional Action/destination label No
Complex (charts, diagrams) Short identifying label Yes — inserted as adjacent text block
Images of text Verbatim transcription No

Note: AI-generated alt-text should be reviewed by a human for accuracy. altscribe is a productivity tool that drafts compliant alt-text — final responsibility for accessibility rests with the content author.

Development

# Install dev dependencies
pip install -e . ruff black pytest

# Run tests
pytest tests/ -v

# Lint
ruff check src/ tests/

# Format
black src/ tests/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

altscribe-0.2.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

altscribe-0.2.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file altscribe-0.2.0.tar.gz.

File metadata

  • Download URL: altscribe-0.2.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for altscribe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c87cb890014cc54a4bea1d13703a470082a7bbd676645808e6c27993cd9b6944
MD5 d25a47bba9bc6ecd9a410d2e1f89c8f6
BLAKE2b-256 35112165288df49349e10ba11ad6f9f142cb7b4266b5ca741c6084e92960320f

See more details on using hashes here.

File details

Details for the file altscribe-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: altscribe-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for altscribe-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa0d457725b2a92863d3d028de482b5a794719bca7d0a3c94cbb1d406a81ac3a
MD5 f16a75e88f3c2ddf0765c8a2b3239dd9
BLAKE2b-256 e45b76e1c8f25a3ce194477c7ba35c1fe31c19eee499c32f90589dd971d76c19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page