Convert Nunjucks to HTML

Nunjucks is a simple templating language where double braces are used to contain expressions. Convert nunjucks templates in the browser with support for passing JSON data.

Face with waiting expression Nothing to see yet!

Loading takeymakey...
TakeyMakey code
Want this tool to do something else? Edit the code below and make it do whatever you want.
({
  take: [
    { key: "code", type: "code", label: "Nunjucks" },
    { key: "data", type: "json", label: "Data" },
    { key: "escape", type: "toggle", label: "Escape characters" },
    { key: "trim", type: "toggle", label: "Trim blocks", value: true },
    {
      type: "import",
      value: "https://mozilla.github.io/nunjucks/files/nunjucks.min.js",
    },
  ],
  make: ({ code, data, escape, trim }) => {
    nunjucks.configure({ autoescape: escape, trimBlocks: trim })

    return [
      {
        type: "code",
        value: nunjucks.renderString(code, data),
      },
    ]
  },
})