Add JSON output for unknown root messages

This commit is contained in:
Christian Bundy 2019-08-13 19:20:10 -07:00
parent c32b0cd2b5
commit 5e63ad6216
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
1 changed files with 9 additions and 2 deletions

View File

@ -12,9 +12,11 @@ const {
img,
section,
span,
summary
summary,
pre
} = require('hyperaxe')
const highlightJs = require('highlight.js')
const lodash = require('lodash')
module.exports = ({ msg }) => {
@ -70,7 +72,12 @@ module.exports = ({ msg }) => {
messageClasses.push('reply')
}
const articleElement = article({ class: 'content', innerHTML: markdownContent })
const emptyContent = '<p>undefined</p>\n'
const articleElement = markdownContent === emptyContent
? article({ class: 'content' }, pre({
innerHTML: highlightJs.highlight('json', JSON.stringify(msg, null, 2)).value
}))
: article({ class: 'content', innerHTML: markdownContent })
const articleContent = hasContentWarning
? details(