Kramdown not processing doctype as HTML

This code:

---
title: About
---
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>{{ page.title }}</title>
</head>
<body markdown=1>
# {{ "Hello World!" | downcase }}
</body>
</html>

Outputs this:


<!doctype html>

hello world!


How can I not have the doctype processed as plain text?

I’m guessing your code is in a markdown file (i.e. with a markdown extension, like about.md). If so, I don’t think there is any way to directly output the doctype declaration from Markdown using Kramdown – it will always see it as Markdown text, and convert the doctype to HTML.

Markdown processing (whether with Jekyll or elsewhere) usually relies on some form of templating/layouts to provide the HTML skeleton. With Jekyll, you could define a minimal layout with just the doctype declaration, and apply that layout to the markdown page. Like this:

_layouts/default.html:

<!doctype html>
{{ content }}

about.md:

---
title: About
layout: default
---
<html>
...as in original above...
</html>