Closed seekshiva closed 8 years ago
I'm trying to do something like this:
return h('div', [
h('div', [
h('h3', [
h('a', { href: issue.html_url }, issue.title)
])
]),
username + ' commented on an issue.',
h('br'), h('br'),
- h('div', comment.body),
+ h('div', marked(comment.body)),
h('br'), h('br')
])
I'm using the marked plugin to convert markdown to html string. It would be great if virtual-dom
can handle it, instead of me having to manually change innerHTML after every render.
I'm using CycleJS, so, in a way I don't control the rendering. It would be great the html string can be passed directly to virtual-dom
itself.
h('div', {innerHTML: marked(comment.body)})
wow! Thanks
I use innerHTML property. It has a caveat b/c it will be in conflict with any child nodes you pass. I believe the innerHTML property wins.
Depending on version of vdom, you also might find that you need to set this property with a hook. I say this because my team is a couple versions behind latest and I'm not sure if this has changed.
This next part goes without saying... Be sure you sanitize the string passed to innerHTML or you'll have a xss vulnerability.