alt_check: Check for Problems with the Alt Text for Images on a Web Page

Description Usage Arguments Value Examples

View source: R/check.R

Description

Infer whether an image's alt tag is missing or could be improved.

Usage

1
2
3
4
5
6
7
alt_check(
  attributes_df,
  max_char = 125,
  min_char = 20,
  file_ext = ".jpg$|.jpeg$|.png$|.svg$|.gif$",
  redundant_pattern = "image|picture|photo|graph|plot|diagram"
)

Arguments

attributes_df

A data.frame/tibble with image attributes, produced by alt_get.

max_char

A numeric value. Alt text longer than this is flagged.

min_char

A numeric value. Alt text shorter than this is flagged.

file_ext

A character string. A regular expression of image file extensions.

redundant_pattern

A character string. A regular expression of 'redundant' phrases in alt text.

Value

A tibble object with classes tbl_df, tbl and data.frame. In addition to columns provided by alt_get, also returns:

Examples

1
2
3
4
5
6
## Not run: 
    url <- "https://alphagov.github.io/accessibility-tool-audit/test-cases.html#images"
    attr_df <- alt_get(url)
    alt_check(attr_df)
    
## End(Not run)

matt-dray/altcheckr documentation built on Jan. 21, 2021, 8:02 a.m.