({
take: [
{ key: "code", type: "code", label: "Pug" },
{ key: "pretty", type: "toggle", label: "Pretty" },
{
key: "doctype",
type: "dropdown",
label: "Doctype",
options: ["HTML5", "None"],
},
{ key: "locals", type: "json", label: "Locals" },
{ type: "import", value: "https://pugjs.org/js/pug.js" },
],
make: (data) => {
const opts = {
pretty: data.pretty,
doctype: data.doctype === "HTML5" ? "html" : "",
...data.locals,
}
const value = require("pug").render(data.code, opts).trim()
return [{ type: "code", value }]
},
})