rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.86k stars 969 forks source link

fig.cap doesn't work for plotly for html notebook (but work for pure html) #1764

Open everdark opened 4 years ago

everdark commented 4 years ago

Here is an example Rmd:

---
title: "R Notebook"
output:
  html_notebook:
    fig_caption: yes
  html_document:
    df_print: paged
---

```{r, fig.cap="About cars"}
plot(cars)
library(plotly)
plot_ly(data=cars, x=~speed,y=~dist, type="scatter", mode="markers")


I notice that there is a fix for `knitr` at https://github.com/yihui/knitr/issues/1223 when `fig.cap` also doesn't work for plotly. But The fix seems not applicable to `html_notebook`?

---

By filing an issue to this repo, I promise that

- [x ] I have fully read the issue guide at https://yihui.org/issue/.
- [x ] 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.
- [x ] 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.
cderv commented 2 years ago

From your example, fig.cap doesn't work either for plots, right ?

I believe html_notebook format is tied to the IDE and supporting fig.cap for html_notebook requires support in RStudio IDE directly.

That is my understanding. @yihui do you share this ? Do you know how html_notebook() does specific ?