How to insert raw HTML in Pug file (not include external HTML file)

This is a tested example with passing variables with raw html to the pug file:

yourSourceFile.js

const p1 = 'This server uses a <a href="https://pugjs.org/api/getting-started.html" target="_blank">pug template</a> for the html output'
res.render('yourTemplateFile', { title: 'Hey', p1 })

yourTemplateFile.pug

html
  head
    title= title
  body
    p
      | !{p1}

Pug text can include HTML. Just force it as text, and it should parse:

html
    head

    body
        | <div><a href="lala"> blabla </a></div>

        p hihuhohoo

Also, you were using backslashes, not forward slashes, to close elements.

Tags:

Html

Pug