WebReflection / lighterhtml

The hyperHTML strength & experience without its complexity 🎉
https://medium.com/@WebReflection/lit-html-vs-hyperhtml-vs-lighterhtml-c084abfe1285
ISC License
735 stars 20 forks source link

Not convert to string #32

Closed alexey13 closed 5 years ago

alexey13 commented 5 years ago

Good day! Thank you for awesome work. Love to use lighterhtml with state, actions, view model. I am trying to inject html content from save place but it get stringify by default right? Example

const articleHtml = article => html`
    <div class="article col-md-6">
        <div class="article-header d-flex justify-content-between">
            <a href="#" class="article-name">${article.title}</a>
        </div>
            <div class="article-body">${article.text}</div>
            <div class="article-footer text-right">
             <button data-id="${article.id}" onclick=${actions.edit} class="btn btn-inverted"></button>
            </div>
    </div>
`;

Article text is a html content and i want to get it as html and not string. Thanks in advance!

alexey13 commented 5 years ago

Oh, found an answer. In your comment. Again thanks. ${{html: article.text}}

WebReflection commented 5 years ago

Just be sure your output is sanitized/safe/no XSS prone 😉