Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions news/changelog-1.11.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ All changes included in 1.11:
- ([#14996](https://github.com/quarto-dev/quarto-cli/pull/14996)): Fix `controls: auto` and `previewLinks: auto` set at the top level of a revealjs document's front matter producing a presentation that fails to load, because `auto` was written unquoted into the generated JavaScript.
- ([#15007](https://github.com/quarto-dev/quarto-cli/pull/15007)): Fix Home/End on a focused tabset tab also jumping to the first or last slide in addition to switching tabs.
- ([#15014](https://github.com/quarto-dev/quarto-cli/issues/15014)): Fix code blocks at the end of a callout losing their bottom spacing, which made the code block border touch the callout border in untitled `appearance="simple"` callouts (regression introduced in v1.8.15).
- ([#15036](https://github.com/quarto-dev/quarto-cli/issues/15036)): Fix callouts with an id rendering that id twice, on the callout and on a wrapper div, in `revealjs` and `epub` output. The id is now only on the `.callout` div, as in `html` output.
- ([#15037](https://github.com/quarto-dev/quarto-cli/pull/15037)): Fix `dracula` theme coloring a `<b>` in a callout title with the theme's bold color, unlike `<strong>`.

### `typst`
Expand Down
11 changes: 7 additions & 4 deletions src/resources/filters/customnodes/callout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ function _callout_main()
attributes:insert("callout-style-" .. calloutAppearance)

local result = pandoc.Div({ calloutBody }, pandoc.Attr(node.attr.identifier 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)
-- in revealjs or epub, if there are leftover classes or attributes,
-- then we need to wrap the callout in a div (#5208, #6853).
-- The identifier stays on the callout div only, so it isn't duplicated.
if #node.attr.classes > 0 or #node.attr.attributes > 0 then
local wrapperAttr = node.attr:clone()
wrapperAttr.identifier = ""
return pandoc.Div({ result }, wrapperAttr)
else
return result
end
Expand Down
2 changes: 2 additions & 0 deletions tests/docs/playwright/revealjs/heading-color/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/.quarto/

**/*.quarto_ipynb
65 changes: 65 additions & 0 deletions tests/docs/smoke-all/revealjs/callout-id.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Callout ids appear once in revealjs
format: revealjs
_quarto:
tests:
revealjs:
ensureHtmlElements:
- - 'div.callout#titled'
- 'section > div.callout#untitled' # id-only callout: no wrapper
- 'div.callout#tip-xref'
- 'a.quarto-xref[href="#/tip-xref"]'
- 'div.fragment > div.callout#with-fragment'
- 'div[data-x="1"] > div.callout#with-attr'
- 'div.fragment.test-no-id > div.callout' # no-id wrapper unchanged
- - '[id="titled"] [id="titled"]'
- '[id="untitled"] [id="untitled"]'
- '[id="tip-xref"] [id="tip-xref"]'
- '[id="with-fragment"] [id="with-fragment"]'
- '[id="with-attr"] [id="with-attr"]'
---

The revealjs callout renderer wraps the callout in a div carrying the
user's leftover attributes (classes such as `.fragment`, extra attributes).
The identifier must end up on exactly one element, the `.callout` div, and
an id-only callout needs no wrapper at all. A callout with a leftover
`data-*` attribute keeps it on the wrapper, and a callout with a fragment
class but no id keeps its wrapper unchanged.

## Titled callout with an id

::: {#titled .callout-note title="Titled"}
Body.
:::

## Untitled callout with an id

::: {#untitled .callout-warning}
Body.
:::

## Cross-referenceable callout

::: {#tip-xref .callout-tip title="Xref"}
Body.
:::

See @tip-xref.

## Callout with an id and a fragment class

::: {#with-fragment .callout-note .fragment}
Body.
:::

## Callout with an id and a data attribute

::: {#with-attr .callout-note data-x="1"}
Body.
:::

## Callout with a fragment class and no id

::: {.callout-note .fragment .test-no-id}
Body.
:::
Loading