From dd9df3aca98624588d456b715ab255c799f9a039 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Wed, 15 Nov 2023 08:45:18 -0700 Subject: [PATCH 1/2] lightbox treatment for fixup --- src/resources/filters/quarto-post/html.lua | 5 +++++ 1 file changed, 5 insertions(+) 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 From 6a731576c2443c9dced97eb3e8a136cc86698ec5 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Wed, 15 Nov 2023 08:48:38 -0700 Subject: [PATCH 2/2] regression test --- tests/docs/smoke-all/2023/11/15/7516-b.qmd | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/docs/smoke-all/2023/11/15/7516-b.qmd 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