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

Additional fix for #7516 (fig-align in non-float knitr image) #7595

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/resources/filters/quarto-post/html.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ function render_html_fixups()
-- CSS we use for FloatRefTargets

local lst = quarto.utils.match(".cell-output-display/:child/{Para}/:child/{Image}")(div)
-- ideally, we'd do the lightbox processing after this fixup, but ordering matters,
-- so we need to check for a potential output of the lightbox filter here
if not lst or #lst == 0 then
lst = quarto.utils.match(".cell-output-display/:child/{Para}/:child/Link/:child/{Image}")(div)
end
if not lst or #lst == 0 then
return
end
Expand Down
38 changes: 38 additions & 0 deletions tests/docs/smoke-all/2023/11/15/7516-b.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
format:
html:
lightbox: true
_quarto:
tests:
html:
ensureHtmlElements:
-
- ".quarto-figure-left>figure>div"
- ".quarto-figure-center>figure>p"
- ".quarto-figure-right>figure>p"
---

```{r}
#| fig-align: right
library(ggplot2)
ggplot(mtcars, aes(x = cyl, y = mpg)) +
geom_point()
```


```{r}
#| fig-align: center
library(ggplot2)
ggplot(mtcars, aes(x = cyl, y = mpg)) +
geom_point()
```


```{r}
#| label: fig-1
#| fig-align: left
#| fig-cap: Hello this works.
library(ggplot2)
ggplot(mtcars, aes(x = cyl, y = mpg)) +
geom_point()
```