Show content warnings

This commit is contained in:
cel
2019-08-29 13:10:59 -07:00
parent 332c09b046
commit ca9ab26ec6
2 changed files with 13 additions and 2 deletions
+8 -1
View File
@@ -578,7 +578,14 @@ function renderPost(opts, id, c) {
content += 'Re: ' + h('a',
{ href: '/' + encodeURIComponent(c.root) },
c.root.substring(0, 10)).outerHTML + '<br>'
s.innerHTML = content + marked(String(c.text), opts.marked)
var textHTML = marked(String(c.text), opts.marked)
if (typeof c.contentWarning === 'string') {
textHTML = h('details',
h('summary', 'Content warning: ' + c.contentWarning),
h('div', {innerHTML: textHTML})
).outerHTML
}
s.innerHTML = content + textHTML
return s
}