yarr icon indicating copy to clipboard operation
yarr copied to clipboard

Hint for unescaping without using html2hscript

Open adicirstei opened this issue 9 years ago • 1 comments

Hi @channikhabra,

Thanks a lot for the effort you spent making this tutorial. Regarding the final chapter where you used html2hscript to unescape the post.content there is an easier approach, even though I'm not sure how secure it is. You can simply set the DOM innerHTML with the post.content like bellow.

<div className="post-body" innerHTML={post.content} > 
</div>

or in plain hyperscript:

h('div', {className: "post-body", innerHTML: post.content})

adicirstei avatar Aug 06 '15 08:08 adicirstei

Oh! I didn’t know that. Thanks. Guess I should read the docs properly. I’ll check it when I have some free time later and will probably update the code in tutorial. Thanks again.


Charanjit Singh Github https://github.com/channikhabra || Twitter https://twitter.com/channikhabra || +91-7696166158

On 06-Aug-2015, at 2:09 pm, adicirstei [email protected] wrote:

Hi @channikhabra https://github.com/channikhabra,

Thanks a lot for the effort you spent making this tutorial. Regarding the final chapter where you used html2hscript to unescape the post.content there is an easier approach, even though I'm not sure how secure it is. You can simply set the DOM innerHTML with the post.content like bellow.

or in plain hyperscript:

h('div', {className: "post-body", innerHTML: post.content}) — Reply to this email directly or view it on GitHub https://github.com/channikhabra/yarr/issues/20.

bitspook avatar Aug 06 '15 08:08 bitspook