knitr
knitr copied to clipboard
support fig.alt for non HTML output
This would be nice to have fig.alt
work also for other outputs than Pandoc supports.
See discussion and notes :
- About support in DOCX: https://github.com/yihui/knitr/pull/1900#issuecomment-717101270
- About support in Pandoc in general: https://github.com/yihui/knitr/issues/1965#issuecomment-777584905
What we know is
- Office supports alt text and Pandoc supports it. It would requires a special handling though as the syntax work well for docx only (not HTML for example)
- For latex and PDF, it does not seem to exist a generic way but some Journals seems to have solutions in there templates (For example : https://authors.acm.org/journals/how-to-write-alt-text-and-why). So maybe it could be possible to come up with a solution.
Related question on community:
- https://community.rstudio.com/t/how-to-include-both-alt-text-and-caption-in-a-figure-to-knit-to-word-with-rmarkdown/95662/2
See a user's workaround in https://github.com/rstudio/rmarkdown/issues/1867#issuecomment-801227405
Hi @cderv (cc @hadley)
Saving this link here for reference on how to add alt text for MS outputs: https://support.microsoft.com/en-us/topic/add-alternative-text-to-a-shape-picture-chart-smartart-graphic-or-other-object-44989b2a-903c-4d9a-b742-6a75b451c669
See discussion in https://github.com/rstudio/rmarkdown/issues/2106#issuecomment-854486564 about PPTX format
For later, this is what we got from Pandoc when parsing the syntax
❯ pandoc -t native
![look a puffin](https://upload.wikimedia.org/wikipedia/commons/9/94/Puffin_Mrkoww.jpg "Title: A proper puffin")
^Z
[Para [Image ("",[],[]) [Str "look",Space,Str "a",Space,Str "puffin"] ("https://upload.wikimedia.org/wikipedia/commons/9/94/Puffin_Mrkoww.jpg","fig:Title: A proper puffin")]]