ui: html problem display

This commit is contained in:
undefined committed 2021-10-27 13:46:14 +08:00
1 parent bf4d0d6fdd
commit 1b906e3eeb
5 files changed
+7 -6

No files matched your search

+2 -1
View File
@@ -9,6 +9,7 @@ const argv = require('cac')().parse();
const { findFileSync } = require('@hydrooj/utils/lib/utils');
const status = require('@hydrooj/utils/lib/status');
const markdown = require('./markdown');
const { xss } = require('./markdown-it-xss');
const { misc, buildContent, avatar } = global.Hydro.lib;
@@ -86,7 +87,7 @@ class Nunjucks extends nunjucks.Environment {
else s = s[langs[0]];
}
if (s instanceof Array) s = buildContent(s, html ? 'html' : 'markdown', (str) => str.translate(language));
return markdown.render(s);
return html ? xss.process(s) : markdown.render(s);
});
this.addFilter('log', (self) => {
console.log(self);