Absolutely!
You can declare something akin to a function, which takes arguments and emits HTML. Imagine e.g.
let taskTemplate = template(task) {
<div class="task">
<span class="title">task.title</span>
</div>
}
for (task in tasks) { taskTemplate(task) }
I'm not decided on syntax yet.You can definitely separate out logic from template this way.
Fun outputs javascript, not HTML - the javascript then builds the DOM.