Skip to content

revealjs - lift Figure.fragment to surrounding div #12605

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

Merged
merged 7 commits into from
Apr 29, 2025
Merged
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
10 changes: 10 additions & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
All changes included in 1.8:

## Formats

### `revealjs`

- ([#12598](https://github.com/quarto-dev/quarto-cli/pull/12598)): Ensure `.fragment` on an image with caption applies to whole figure.

## Projects

### `website`

- ([#12551](https://github.com/quarto-dev/quarto-cli/pull/12551)): Improve warning issued when `aliases` would overwrite an existing document.
15 changes: 11 additions & 4 deletions src/project/types/website/website-aliases.ts
Original file line number Diff line number Diff line change
@@ -106,10 +106,17 @@ export async function updateAliases(

// Write the redirect file
if (allOutputFiles.find((outputFile) => outputFile === targetFile)) {
// Do not, this is the same name as an output file!
warning(
`Aliases that you have created would overwrite the output file ${targetFile}. The aliases file was not created.`,
);
for (
const offendingAlias of targetHrefs.filter(
(targetHref) =>
targetHref.href ===
relative(dirname(targetHref.outputFile), targetFile),
)
) {
warning(
`Requested alias ${targetFile} -> ${offendingAlias.outputFile} would overwrite the target. Skipping.`,
);
}
} else {
// Write, this is a safe file
writeMultipleRedirectPage(targetFile, redirects);
20 changes: 17 additions & 3 deletions src/resources/filters/layout/pandoc3_figure.lua
Original file line number Diff line number Diff line change
@@ -68,11 +68,25 @@ function render_pandoc3_figure()
return {
traverse = "topdown",
Figure = function(figure)
local has_fragment = false
figure.content = _quarto.ast.walk(figure.content, {
Image = function(img)
if img.classes:includes("fragment") then
has_fragment = true
img.classes = img.classes:filter(function(c) return c ~= "fragment" end)
return img
end
end
})

local result = html_handle_linked_image(figure)
if result ~= nil then
return result
if result == nil then
result = html_handle_image(figure)
end
if has_fragment then
result = pandoc.Div(result, pandoc.Attr("", {"fragment"}, {}))
end
return html_handle_image(figure)
return result
end
}
elseif _quarto.format.isLatexOutput() then
13 changes: 13 additions & 0 deletions tests/docs/smoke-all/2025/04/23/issue-12598.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
format: revealjs
_quarto:
tests:
revealjs:
ensureHtmlElements:
- ["div.fragment"]
- []
---

## Slide title

![caption](image.jpg){.fragment}