开发者文档

This commit is contained in:
undefined committed 2020-05-06 12:40:24 +08:00
1 parent 3e9b074e77
commit e7ce8c1f02
42 files changed
+349 -297

No files matched your search

+4 -1
View File
@@ -19,7 +19,10 @@ class Nunjucks extends nunjucks.Environment {
super(new Loader(), { autoescape: true, trimBlocks: true });
this.addFilter('json', (self) => JSON.stringify(self), false);
this.addFilter('assign', (self, data) => Object.assign(self, data));
this.addFilter('markdown', (self) => markdown.render(self));
this.addFilter('markdown', (self, safe = true) => {
if (safe) return markdown.safe.render(self);
return markdown.unsafe.render(self);
});
this.addFilter('base64_encode', (s) => Buffer.from(s).toString('base64'));
}
}