Skip to content

Fix revealjs callout spacing below a final code block - #15031

Merged
cderv merged 1 commit into
mainfrom
fix/revealjs-callout-code-copy-scaffold
Oct 13, 2026
Merged

cderv merged 1 commit into
mainfrom
fix/revealjs-callout-code-copy-scaffold

Conversation

@cderv

@cderv cderv commented Oct 12, 2026

Copy link
Copy Markdown
Member

When a code block is the last element of a callout in Revealjs, it sits against the bottom of the callout since 1.8.15. With appearance="simple" and no title, the code block border touches the callout border.

Root cause

Since #13024, code blocks are wrapped in a div.code-copy-outer-scaffold for the copy button, and Revealjs uses the same HTML postprocessor. Two rules added in #11251 for a code block in last position select div.sourceCode as the last child of .callout-content, so they no longer match:

  • In titled callouts, the last child gets padding-bottom: 0.5rem and no margin, except a div.sourceCode. The scaffold is not excluded, so it gets the 8px padding instead of the 12px block margin.
  • In simple untitled callouts, a last div.sourceCode gets margin-bottom: 1rem. This rule never matches now.

Fix

Both selectors now also match div.code-copy-outer-scaffold. The margin is set on the scaffold itself. It has no padding or border, so the spacing is the same as in 1.7.34 (12px in titled callouts, 16px in simple untitled ones). The :not() uses a selector list, so the specificity of the titled rule doesn't change. The div.sourceCode selectors are kept for code-copy: false, where there is no scaffold.

The new Playwright test measures the space below the last block of the callout, divided by Reveal.getScale(), for three callouts ending with code and two ending with a paragraph as controls.

Fixes #15014

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

Since 1.8.15 the HTML postprocessor wraps code blocks in
div.code-copy-outer-scaffold for the copy button, and revealjs uses it.
The last child of .callout-content is then the scaffold, not
div.sourceCode, so the two last-child rules written for a code block in
last position stopped matching:

- titled callouts: the scaffold was not excluded from the paragraph
  rule, so it got 0.5rem padding and no margin instead of the block
  margin (8px instead of 12px below the code);
- simple untitled callouts: the 1rem margin rule never matched, so the
  code block border touched the callout border.

Both selectors now also match the scaffold. The margin goes on the
scaffold itself: it has no padding or border, so this reproduces the
1.7.34 layout exactly. The :not() selector list keeps the rule's
specificity unchanged. The plain div.sourceCode selectors stay for
code-copy: false, where there is no scaffold.

The Playwright test measures the gap below the last block, normalized
by Reveal.getScale() and the callout border, for three callouts ending
with code and two ending with a paragraph as controls.

Fixes #15014
@posit-snyk-bot

posit-snyk-bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit 53fda81 into main Oct 13, 2026
51 checks passed
@cderv
cderv deleted the fix/revealjs-callout-code-copy-scaffold branch October 13, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revealjs: code block at the end of a callout lost its bottom spacing since 1.8.15

2 participants