quarto-dev / quarto-dev/quarto-cli
`fig-alt` removed by Quarto at least for `docx` (works with Pandoc)
@cscheid is already working on this.
Since Dec 15, 2023.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Edited: based on @cderv comment and with additional examples
Considering the below example for Quarto fig-alt attribute:
## Section
{fig-alt="Quarto Logo"}
quarto pandoc index.qmd --from markdown --to docx -o index.docx |
quarto render index.qmd --to docx |
|---|---|
Using Pandoc markup, caption + alt text ends up in Word alt text (so no real issues):
## Section

quarto pandoc index.qmd --from markdown --to docx -o index.docx |
quarto render index.qmd --to docx |
|---|---|
Using computations:
## Section
```{r}
#| label: fig-plot
#| fig-cap: "A caption for a plot"
#| fig-alt: "An alt text for a plot"
plot(1)
```
quarto pandoc index.qmd --from markdown --to docx -o index.docx |
quarto render index.qmd --to docx |
|---|---|
| Obviously not working |
Note that computation with figures will generate the following markdown (for both knitr/Jupyter):
{#fig-plot fig-alt='An alt text for a plot'}
The initial question also mentioned pdf, but I don't even know how to show alternative text in PDF.
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/5511
Originally posted by IZE85 May 12, 2023
In MS Word, one is able to "add alternative text to a shape, picture, chart, SmartArt graphic, or other object to help people with visual disabilities."
When I add alternative text to a figure via "fig-alt" it gets exported via HTML. Unfortunately, when knitting to formats like Word or PDF, my fig-alt text is saved/deposited somewhere, if I'm correct. At least, for MS Word, I cannot see the alternative text in the "alternative text" field, MS Word provides for figures.
My question: Is it possible for the fig-alt text to find its way into the MS Word Alternative text field and have something similar for PDFs?
Thank you in advance!
Ad alternative text:
"Alt text helps people with visual disabilities understand pictures and other graphical content. When someone using a screen reader comes across a picture in a document, they will hear the alt text describing the picture; without alt text, they will only know they've reached a picture without knowing what the picture shows."
Source: https://support.microsoft.com/en-us/office/add-alternative-text-to-a-shape-picture-chart-smartart-graphic-or-other-object-44989b2a-903c-4d9a-b742-6a75b451c669
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.