Commit 78ab1d7d authored by Anton's avatar Anton

Make link target configurable in MarkdownDisplay

parent fbf52c66
......@@ -6,14 +6,20 @@
import marked from 'marked'
import sanitizeHtml from 'sanitize-html'
const sanitizer = data => {
const sanitizer = (data, opts = {}) => {
const tagOptions = {
a: {}
}
if (opts.target) {
tagOptions.a.target = opts.target
}
return sanitizeHtml(data, {
allowedTags: ['b', 'i', 'em', 'strong', 'a', 'br', 'p'],
allowedAttributes: {
'a': ['href', 'target', 'name']
},
transformTags: {
'a': sanitizeHtml.simpleTransform('a', { target: '_blank' })
'a': sanitizeHtml.simpleTransform('a', tagOptions.a)
}
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment