Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html from database #75

Closed
mrherndon opened this issue May 22, 2018 · 4 comments
Closed

html from database #75

mrherndon opened this issue May 22, 2018 · 4 comments

Comments

@mrherndon
Copy link

mrherndon commented May 22, 2018

I've been having a hard time all day with this one.
I have a complicated templating system, but I'll simplify here.

So I've got some templates that pull from json:

image

image
They render as I would expect:, (note the text break)
image

And I have other ones that pull very similar content from the database. It essentially looks the same. But it renders it all as text.
image

I have tried wrapping the db entry in html`` and creating a function that wraps it. Nothing seems to work. Is there a way to insert html in a ${} and preserve the html-ness?

@eskan
Copy link

eskan commented May 23, 2018

@mrherndon
Copy link
Author

Well, that is straight embarrassing. I'm already pulling repeat from lit anyway. Didn't even think to look through there.
As an added bonus, I was very close to doing exactly what unsafeHTML was doing but didn't think to innerHTML a template element. Apparently, it solves the issues that I was running into.
Thanks, @eskan, you rock.
After I confirm that it works, I'll come back and close this out, and my shame with it.

@mrherndon
Copy link
Author

Yup, totally solves the problem.

@TimvdLippe
Copy link
Contributor

No shame at all! Mistakes happen and this was easy to overlook. Glad the function solved your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants