mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
开发者文档
This commit is contained in:
1 parent
3e9b074e77
commit
e7ce8c1f02
42 files changed
+349
-297
No files matched your search
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user