Lume omit doctype?

22 Views Asked by At

Is it possible in Lume, using Nunjucks, to refrain from rendering a doctype?

I am using Lume to create HTML snippets, destined for another system. (I'm not rendering entire HTML pages.) The doctype gets in the way.

Example input:

<div>Hello world</div>

renders thus

<!doctype html>
<div>Hello world</div>

I'd like it to stop doing that. Thanks.

1

There are 1 best solutions below

1
Óscar On BEST ANSWER

Lume adds the doctype automatically (see issue), but you can remove it with a preprocessor:

site.process([".html"], (page) => {
  page.content = page.content.replace("<!DOCTYPE html>\n", "");
});