Skip to content

Commit 594d047

Browse files
put quarto-html-before-body script really at top
we don't have complete control over where 'before body' really is, with so many components contributing to the array via mergeConfigs so use a postprocessor for this
1 parent 7d45e02 commit 594d047

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ import {
7878
documentTitleScssLayer,
7979
processDocumentTitle,
8080
} from "./format-html-title.ts";
81-
import {
82-
darkModeDefault,
83-
} from "./format-html-info.ts";
81+
import { darkModeDefault } from "./format-html-info.ts";
8482

8583
import { kTemplatePartials } from "../../command/render/template.ts";
8684
import { isHtmlOutput } from "../../config/format.ts";
@@ -520,6 +518,14 @@ function bootstrapHtmlPostprocessor(
520518
);
521519
resources.push(...titleResourceFiles);
522520

521+
// put quarto-html-before-body script at top of body
522+
const beforeBodyScript = doc.querySelector(
523+
"script#quarto-html-before-body",
524+
);
525+
if (beforeBodyScript) {
526+
doc.body.insertBefore(beforeBodyScript, doc.body.firstChild);
527+
}
528+
523529
// Process the elements of this document into an appendix
524530
if (
525531
format.metadata[kAppendixStyle] !== false &&

0 commit comments

Comments
 (0)