8000
Skip to content

Feature request: fig.alt as a chunk option #1867

@mdogucu

Description

@mdogucu

In addition to using ![alt text][id] to write alt text it would be very useful to have fig.alt option for code chunks that could write the alt text for a figure. Unfortunately, with the current state of things, the figure caption and alt text is the same when used in code chunk. Thus, when using a screen reader only figure caption is read by the screen reader. However, for visually impaired readers, often further description of an image is needed. An example of what I have on my mind is provided below with modifications to the code provided in the R Markdown book:

```{r mtcars, fig.cap = "Another amazing plot", fig.alt = "The scatter plot has hp on the x axis and mpg on the y axis. The points show a negative trend but the plot does not include a line of best fit."}
plot(mpg ~ hp, mtcars)
```

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0