Skip to content

Commit

Permalink
Merge pull request #7111 from quarto-dev/bugfix/6853
Browse files Browse the repository at this point in the history
revealjs: wrap callout in div if attr is nontrivial
  • Loading branch information
cscheid authored Oct 2, 2023
2 parents 5cea1af + 78b47f6 commit 19ab254
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/changelog-1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- ([#5783](https://github.com/quarto-dev/quarto-cli/issues/5783)): Ensure fenced code blocks work with line numbers.
- ([#6120](https://github.com/quarto-dev/quarto-cli/issues/6120)): `pdf-max-pages-per-slide` is now correctly setting [`pdfMaxPagesPerSlide` config](https://revealjs.com/pdf-export/#page-size) for RevealJS.
- ([#6827](https://github.com/quarto-dev/quarto-cli/issues/6120)): Correctly layout callout in revealjs slides when changing appearance.
- ([#6853](https://github.com/quarto-dev/quarto-cli/issues/6853), [#5208](https://github.com/quarto-dev/quarto-cli/issues/5208)): Wrap callout in div when attr is non-empty.
- ([#7042](https://github.com/quarto-dev/quarto-cli/issues/7042)): Line highligthting now works correctly with code annotation.
- ([#7104](https://github.com/quarto-dev/quarto-cli/issues/7104)): Line highlighting progressive reveal now correctly has code annotation anchor on the right.

Expand Down
10 changes: 9 additions & 1 deletion src/resources/filters/customnodes/callout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,15 @@ function epubCallout(node)
end
attributes:insert("callout-style-" .. calloutAppearance)

return pandoc.Div({calloutBody}, pandoc.Attr(node.id or "", attributes))
local result = pandoc.Div({calloutBody}, pandoc.Attr(node.id or "", attributes))
-- in revealjs or epub, if the leftover attr is non-trivial,
-- then we need to wrap the callout in a div (#5208, #6853)
if node.attr.identifier ~= "" or #node.attr.classes > 0 or #node.attr.attributes > 0 then
return pandoc.Div({ result }, node.attr)
else
return result
end

end

function simpleCallout(node)
Expand Down
19 changes: 19 additions & 0 deletions tests/docs/smoke-all/2023/10/02/6853.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
format: revealjs
title: test
_quarto:
tests:
revealjs:
ensureHtmlElements:
- ["div.fragment", "div#hello-world"]
- []
---


::: {#hello-world .callout-note .fragment}

## A title

Some content

:::

0 comments on commit 19ab254

Please sign in to comment.