diff --git a/src/resources/filters/layout/columns-preprocess.lua b/src/resources/filters/layout/columns-preprocess.lua index fa9491ffe0..d68df8e366 100644 --- a/src/resources/filters/layout/columns-preprocess.lua +++ b/src/resources/filters/layout/columns-preprocess.lua @@ -4,6 +4,9 @@ function columns_preprocess() return { FloatRefTarget = function(float) + if float.parent_id ~= nil then + return nil + end local location = cap_location(float) if location == 'margin' then float.classes:insert('margin-caption') diff --git a/src/resources/filters/layout/html.lua b/src/resources/filters/layout/html.lua index c9de9ace9d..9202192301 100644 --- a/src/resources/filters/layout/html.lua +++ b/src/resources/filters/layout/html.lua @@ -83,7 +83,12 @@ end, function(panel_layout) }) decorate_caption_with_crossref(float_tbl) rendered_panel = float_reftarget_render_html_figure(float_tbl) - rendered_panel.attr = pandoc.Attr(panel_layout.identifier, {"quarto-layout-panel"}) + local panel_attr = pandoc.Attr(panel_layout.identifier, {"quarto-layout-panel"}) + -- https://github.com/quarto-dev/quarto-cli/issues/1173 + if rendered_panel.classes:includes("margin-caption") then + panel_attr.classes:insert("margin-caption") + end + rendered_panel.attr = panel_attr else rendered_panel = panel rendered_panel.attr = pandoc.Attr(