diff --git a/src/resources/filters/quarto-post/html.lua b/src/resources/filters/quarto-post/html.lua index 0f36a8ed20..b0c2fb70d5 100644 --- a/src/resources/filters/quarto-post/html.lua +++ b/src/resources/filters/quarto-post/html.lua @@ -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 diff --git a/tests/docs/smoke-all/2023/11/15/7516-b.qmd b/tests/docs/smoke-all/2023/11/15/7516-b.qmd new file mode 100644 index 0000000000..e9dbbc5af0 --- /dev/null +++ b/tests/docs/smoke-all/2023/11/15/7516-b.qmd @@ -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() +``` \ No newline at end of file