access_head | R Documentation |
Reads an Rmd file, converting the YAML header to a format that is screen reader friendly.
access_head( rmd_path = NULL, lan = detect_html_lang(lines), inplace = FALSE, encoding = "utf-8", theme = "default", highlight = "null" )
rmd_path |
Path to the Rmd that requires accessible header metadata. Rmd must be output type html. |
lan |
Identify the language of text content. Attempts to find a lang attribute value from the rmd document. Alternatively, use a character string such as "en". |
inplace |
When set to FALSE (the default) writes to new file. If TRUE, writes in place. |
encoding |
Defaults to utf-8. |
theme |
Set to "default", currently the only in-built theme that does not result in accessibility errors. |
highlight |
Set to "null", currently the only in-built highlight that does not result in accessibility errors. |
Adjust the Rmd YAML provided to rmd_path
, improving its
accessibility for screen readers. Only works with html output.
# create a testfile rmd <- tempfile("testing", fileext = ".rmd") # write basic markdown content writeLines('--- title: "testfile" author: "Some Author" date: "`r format(Sys.Date(), "%d %b %Y")`" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## R Markdown', con = rmd) # Adjust the document header to improve screen reader accessibility access_head(rmd, lan = "en")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.