-
-
Notifications
You must be signed in to change notification settings - Fork 878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fig.cap and fig.alt appear redundant (fig.alt is preferred) #2029
Comments
Thanks for the report. |
Can you clarify what results you are expecting ? The ---
title: Testing alt-text
output:
html_document:
keep_md: true
---
```r
knitr::include_graphics("mcgriff.png")
```
<img src="mcgriff.png" width="340" />
```r
knitr::include_graphics("mcgriff.png")
```
<div class="figure">
<img src="mcgriff.png" alt="Caption only." width="340" />
<p class="caption">Caption only.</p>
</div>
```r
knitr::include_graphics("mcgriff.png")
```
<div class="figure">
<img src="mcgriff.png" alt="This has alt text too." width="340" />
<p class="caption">Caption and alt text.</p>
</div>
```r
knitr::include_graphics("mcgriff.png")
```
<img src="mcgriff.png" title="This only has alt text." alt="This only has alt text." width="340" /> It seems in this case, this is the expected result. isn't it ? It would be interesting to have the detailed of what you expect. Either in the issue discussion here, or as detailed explanation in your PR. Changing this feature is touchy and we need to make sure we improve one output without breaking another one. That is why I am interested in the detail of your use case (you are not using rmarkdown and only knitr ? Thanks! |
Yes, I am only using Specifically, the output is: ---
title: Testing alt-text
---
```r
knitr::include_graphics("mcgriff.png")
```
![plot of chunk nothing](mcgriff.png)
```r
knitr::include_graphics("mcgriff.png")
```
![Caption only.](mcgriff.png)
```r
knitr::include_graphics("mcgriff.png")
```
<img src="mcgriff.png" title="This has alt text too." alt="This has alt text too." />
```r
knitr::include_graphics("mcgriff.png")
```
<img src="mcgriff.png" title="This only has alt text." alt="This only has alt text." /> while I would hope it would be ---
title: Testing alt-text
---
```r
knitr::include_graphics("mcgriff.png")
```
![plot of chunk nothing](mcgriff.png)
```r
knitr::include_graphics("mcgriff.png")
```
![Caption only.](mcgriff.png)
```r
knitr::include_graphics("mcgriff.png")
```
<img src="mcgriff.png" title="Caption and alt text." alt="This has alt text too." />
```r
knitr::include_graphics("mcgriff.png")
```
<img src="mcgriff.png" title="This only has alt text." alt="This only has alt text." /> |
The reason I'm knitting to a markdown doc rather than html directly is because it's part of a jekyll site setup, fwiw. Part of a carpentries lesson. |
That is really interesting. We don't have a That makes sense to me now. Thanks for the precision! |
I was very grateful to find the new alt-text feature. However it doesn't seem to work as described, and when both
fig.cap
andfig.alt
are supplied, onlyfig.alt
is present in the output. This is not ideal as alt-text may need be more detailed than the caption for some images.I have made a tiny testing repo here to demonstrate: https://github.com/Alanocallaghan/testalt/
The issues page suggests zipfiles, so here's that repo as a zip too: testalt.zip
By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. 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('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: