Skip to content

Commit a3a2cb5

Browse files
authored
Merge pull request #8889 from quarto-dev/bugfix/8382
revealjs - strip whitespace from columns at runtime. Closes #8382
2 parents 13b3377 + 4576841 commit a3a2cb5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

news/changelog-1.5.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ All changes included in 1.5:
77
- ([#8311](https://github.com/quarto-dev/quarto-cli/issues/8311)): Correct z-order for margins with no contents
88
- ([#8862](https://github.com/quarto-dev/quarto-cli/issues/8862)): Properly deal with an `aside` within a definition list.
99

10-
## PDF Format:
10+
## PDF Format
1111

1212
- ([#8299](https://github.com/quarto-dev/quarto-cli/issues/8299)): Don't use `rsvg-convert` to convert an SVG to PDF when the PDF is already available; add `use-rsvg-convert` option to control this behavior.
1313
- ([#8684](https://github.com/quarto-dev/quarto-cli/issues/8684)): Improve detection and automatic installation of locale specific hyphenation files.
1414
- ([#8711](https://github.com/quarto-dev/quarto-cli/issues/8711)): Enforce rendering of tables as `tabular` environments when custom float environments are present.
1515
- ([#8841](https://github.com/quarto-dev/quarto-cli/issues/8841)): Do not parse LaTeX table when crossref label doesn't start with `tbl-`.
1616

17+
## RevealJS Format
18+
19+
- ([#8382](https://github.com/quarto-dev/quarto-cli/issues/8382)): Strip whitespace from `div.columns` elements that might have been introduced by third-party processing.
20+
1721
## Website
1822

1923
- ([#6779](https://github.com/quarto-dev/quarto-cli/issues/6779)): Add support for `logo-href` and `logo-alt` in `sidebar` (books and websites)

src/resources/formats/revealjs/plugins/support/support.js

+18
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,23 @@ window.QuartoSupport = function () {
301301
}
302302
}
303303

304+
function handleWhiteSpaceInColumns(deck) {
305+
for (const outerDiv of window.document.querySelectorAll("div.columns")) {
306+
// remove all whitespace text nodes
307+
// whitespace nodes cause the columns to be misaligned
308+
// since they have inline-block layout
309+
//
310+
// Quarto emits no whitespace nodes, but third-party tooling
311+
// has bugs that can cause whitespace nodes to be emitted.
312+
// See https://github.com/quarto-dev/quarto-cli/issues/8382
313+
for (const node of outerDiv.childNodes) {
314+
if (node.nodeType === 3 && node.nodeValue.trim() === "") {
315+
outerDiv.removeChild(node);
316+
}
317+
}
318+
}
319+
}
320+
304321
return {
305322
id: "quarto-support",
306323
init: function (deck) {
@@ -315,6 +332,7 @@ window.QuartoSupport = function () {
315332
handleTabbyClicks();
316333
handleSlideChanges(deck);
317334
workaroundMermaidDistance(deck);
335+
handleWhiteSpaceInColumns(deck);
318336
},
319337
};
320338
};

0 commit comments

Comments
 (0)