From 0c73546c4544f7a4b87f01c18de062505fe91df8 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Fri, 5 Jan 2024 09:21:38 -0700 Subject: [PATCH] Lua - forward margin-caption to Figure nodes --- src/resources/filters/layout/pandoc3_figure.lua | 4 ++++ tests/docs/smoke-all/2024/01/05/8066.qmd | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/docs/smoke-all/2024/01/05/8066.qmd diff --git a/src/resources/filters/layout/pandoc3_figure.lua b/src/resources/filters/layout/pandoc3_figure.lua index 1778513b569..e83cef6142c 100644 --- a/src/resources/filters/layout/pandoc3_figure.lua +++ b/src/resources/filters/layout/pandoc3_figure.lua @@ -49,6 +49,10 @@ function render_pandoc3_figure() if figure.caption.long ~= nil then image.caption = quarto.utils.as_inlines(figure.caption.long) end + -- TODO need to find all correct classes to forward + if figure.classes:includes("margin-caption") then + image.classes:insert("margin-caption") + end return htmlImageFigure(image) end diff --git a/tests/docs/smoke-all/2024/01/05/8066.qmd b/tests/docs/smoke-all/2024/01/05/8066.qmd new file mode 100644 index 00000000000..737b0ba716e --- /dev/null +++ b/tests/docs/smoke-all/2024/01/05/8066.qmd @@ -0,0 +1,15 @@ +--- +title: "Test" +format: + html: + fig-cap-location: margin +_quarto: + tests: + html: + ensureHtmlElements: + - + - "figcaption.margin-caption" + - [] +--- + +![Test figure caption](https://placeholder.co/400)