Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/pandoc/self-contained.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ export const pandocIngestSelfContainedContent = async (

// The raw html contents
const contents = Deno.readTextFileSync(file);
const doctypeMatch = contents.match(/^<!DOCTYPE.*?>/);
const dom = await parseHtml(contents);
await bundleModules(dom, workingDir);

const input: string[] = [];
input.push("````````{=html}");
if (doctypeMatch) {
input.push(doctypeMatch[0]);
}
input.push(dom.documentElement!.outerHTML);
input.push("````````");

Expand Down
28 changes: 28 additions & 0 deletions tests/docs/smoke-all/2025/04/04/12295.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: DOCTYPE is not lost when using embed-resources
embed-resources: true
_quarto:
tests:
html:
ensureHtmlElements:
- []
- []
ensureFileRegexMatches:
- ['\<\!DOCTYPE html\>']
- []
revealjs:
ensureHtmlElements:
- []
- []
ensureFileRegexMatches:
- ['\<\!DOCTYPE html\>']
- []
---

Example from https://github.com/quarto-dev/quarto-cli/issues/12295: Not having DOCTYPE lead to browser using a Quirk mode for CSS, and not applying the standard HTML5.

## Header

```bash
quarto render --help
```
Loading