Skip to content

Commit f86a12f

Browse files
committed
html,about - don't process column classes inside about divs
1 parent 36ccd88 commit f86a12f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/format/html/format-html-bootstrap.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,13 @@ const figCapInCalloutMarginProcessor: MarginNodeProcessor = {
14611461

14621462
const kPreviewFigColumnForwarding = [".grid"];
14631463

1464+
const isInsideAbout = (el: Element) =>
1465+
!!findParent(
1466+
el,
1467+
(parent) =>
1468+
Array.from(parent.classList).some((x) => x.startsWith("quarto-about-")),
1469+
);
1470+
14641471
const processFigureOutputs = (doc: Document) => {
14651472
// For any non-margin figures, we want to actually place the figure itself
14661473
// into the column, and leave the caption as is, if possible
@@ -1497,13 +1504,19 @@ const processFigureOutputs = (doc: Document) => {
14971504

14981505
// If there is a single figure, then forward the column class onto that
14991506
const figures = columnEl.querySelectorAll("figure img.figure-img");
1500-
if (figures && figures.length === 1) {
1507+
1508+
if (
1509+
figures && figures.length === 1 && !isInsideAbout(figures[0] as Element)
1510+
) {
15011511
moveColumnClasses(columnEl, figures[0] as Element);
15021512
} else {
15031513
const layoutFigures = columnEl.querySelectorAll(
15041514
".quarto-layout-panel > figure.figure .quarto-layout-row",
15051515
);
1506-
if (layoutFigures && layoutFigures.length === 1) {
1516+
if (
1517+
layoutFigures && layoutFigures.length === 1 &&
1518+
!isInsideAbout(layoutFigures[0] as Element)
1519+
) {
15071520
moveColumnClasses(columnEl, layoutFigures[0] as Element);
15081521
}
15091522
}

0 commit comments

Comments
 (0)