Includes

Includes allow you to insert the contents of one Pug file into another.

If the path is absolute (e.g., include /root.pug), it is resolved by prepending options.basedir. Otherwise, paths are resolved relative to the current file being compiled.

If no file extension is given, .pug is automatically appended to the file name.

Including Plain Text

Including non-Pug files simply includes their raw text.

Including Filtered Text

You can combine filters with includes, allowing you to filter things as you include them.

//- index.pug
doctype html
html
  head
    title An Article
  body
    include:markdown-it article.md
# article.md

This is an article written in markdown.
<!DOCTYPE html>
<html>
  <head>
    <title>An Article</title>
  </head>
  <body>
    <h1>article.md</h1>
    <p>This is an article written in markdown.</p>
  </body>
</html>