Is it possible in Pollen to completely avoid typing raw HTML?

I am very new to learning Pollen, maybe I’ve missed something, but all the examples I’ve seen use HTML markup explicitly, at least in template.html.p.

Is it possible to completely avoid raw HTML in the source files? In particular, can I generate <!DOCTYPE html> tag with Pollen markup? Scribble seems to have something for it.

I’m not sure what you mean by “completely avoid raw HTML”. Pollen has conveniences for generating HTML, but also a policy against magic behavior, so it does not automatically inject a DOCTYPE.

Markup source files require the use of a template, so that tends to be a convenient place to insert the DOCTYPE. Though if you want the DOCTYPE to be specified within the markup file, you can do that too:

test.html.pm:

#lang pollen
◊(define-meta doctype "<!DOCTYPE html>")
hello world

template.html.p:

◊(hash-ref metas 'doctype)
◊(->html doc)

result:

<!DOCTYPE html>
<root>hello world</root>