Skip to content

Commit 52a9233

Browse files
committed
support documents without a main element
1 parent 9c87848 commit 52a9233

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/format/html/format-html-title.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,16 @@ export async function canonicalizeTitlePostprocessor(
193193
},
194194
): Promise<HtmlPostProcessResult> {
195195
// https://github.com/quarto-dev/quarto-cli/issues/10567
196+
// this fix cannot happen in `processDocumentTitle` because
197+
// that's too late in the postprocessing order
196198
const titleBlock = doc.querySelector("header.quarto-title-block");
197-
if (!titleBlock) {
198-
const main = doc.querySelector("main");
199-
if (!main) {
200-
throw new InternalError("No main element found in document");
201-
}
199+
200+
const main = doc.querySelector("main");
201+
// if no main element exists, this is likely a revealjs presentation
202+
// which will generally have a title slide instead of a title block
203+
// so we don't need to do anything
204+
205+
if (!titleBlock && main) {
202206
const header = doc.createElement("header");
203207
header.id = "title-block-header";
204208
header.classList.add("quarto-title-block");

0 commit comments

Comments
 (0)