Hand Wraps <! DOCTYPE html>

I'm trying to tune my setup metalsmith, nothing out of the ordinary.

In mine build.jsI have:


handlebars.registerHelper('doctype', function() {
  return new handlebars.SafeString('<!DOCTYPE html>');
});

in my partial template header.hbtI have:

{{doctype}}
<html>

And the html result starts with:

<p>&lt;!DOCTYPE html&gt;</p>

- This is obviously not what I need.

Any suggestions?

PS. Using a simple doctype definition in my layout file had the same effect. Using handlebars ^4.0.5.

Edit 1: Having tried a little, I can put another symptom: the result of the call SafeString()seems to be wrapped in a tag <p>if it is placed before the block <html>. This does not apply to the doctype declaration, “normal” html elements may also be affected.

2: 2x2 SafeString():

a) (, <div>) <html> , , .

b) , <html> , <p>.

c) doctype <html> , : &lt;!DOCTYPE html&gt;

d) doctype <html> , <p>.

+4
1

, metalsmith - , handlebars. (!) : use(layouts(…)) use(markdown(…)). (, markdown .) .

+3

All Articles