Skip to content
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

Using a reference with formulas inside of a figure caption, breaks the generated HTML #1473

Open
5 tasks done
leoschwarz opened this issue Aug 5, 2024 · 0 comments
Open
5 tasks done

Comments

@leoschwarz
Copy link

leoschwarz commented Aug 5, 2024

Dear developers,
The second plot is rendered correctly whereas the first one is messed up unless you add a fig.alt since the unescaped HTML of the formula ends up in the aria-label tag of the <img> element.

---
title: "Circle Plot"
output:
  bookdown::html_document2:
    toc: yes
    toc_depth: 2
---

(ref:caption) The formula for a circle: $x^2 + y^2 = r^2$).

```{r circle-plot, fig.cap="(ref:caption)"}
t <- seq(0, 2*pi, length.out = 1000)
x <- cos(t)
y <- sin(t)

plot(x, y, type = "l", asp = 1, xlab = "x", ylab = "y", main = "Circle")
```

```{r circle-plot2, fig.cap="The formula for a circle: $x^2 + y^2 = r^2$."}
plot(x, y, type = "l", asp = 1, xlab = "x", ylab = "y", main = "Circle")
```
grafik

Checklist

  • formatted your issue so it is easier for us to read?

  • included a minimal, self-contained, and reproducible example?

  • pasted the output from xfun::session_info('bookdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the bookdown package using remotes::install_github("rstudio/bookdown") ?

R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin23.4.0
Running under: macOS Sonoma 14.5

Locale: de_CH / UTF-8 / de_CH / C / de_CH / de_CH

Package version:
  base64enc_0.1.3   bookdown_0.40.1   bslib_0.8.0       cachem_1.1.0
  cli_3.6.3         digest_0.6.36     evaluate_0.24.0   fastmap_1.2.0
  fontawesome_0.5.2 fs_1.6.4          glue_1.7.0        graphics_4.4.1
  grDevices_4.4.1   highr_0.11        htmltools_0.5.8.1 jquerylib_0.1.4
  jsonlite_1.8.8    knitr_1.48        lifecycle_1.0.4   memoise_2.0.1
  methods_4.4.1     mime_0.12         R6_2.5.1          rappdirs_0.3.3
  rlang_1.1.4       rmarkdown_2.27    sass_0.4.9        stats_4.4.1
  tinytex_0.52      tools_4.4.1       utils_4.4.1       xfun_0.46
  yaml_2.3.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant