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

What's the recommended way to add pre-existing HTML? #9

Closed
christianbundy opened this issue Jun 27, 2019 · 2 comments · Fixed by #10
Closed

What's the recommended way to add pre-existing HTML? #9

christianbundy opened this issue Jun 27, 2019 · 2 comments · Fixed by #10

Comments

@christianbundy
Copy link
Contributor

I've got some Markdown I'd like to put in a document, but it looks like hyperaxe escapes it. Here's my current workaround:

article({ innerHTML: markdownContent })

Is that the recommended way to deal with this use-case, or is there a better way to do it?

Thanks for all the work on this module, I'm really loving it so far. I owe you a beer @ungoldman.

@ungoldman
Copy link
Owner

ungoldman commented Jun 27, 2019

That sounds like a good way to do it! This hasn't come up yet tbh, but it's definitely a valid use case.

hyperaxe delegates to hyperscript under the hood unless you substitute your own hyperscript implementation with createFactory, so I'd say do what works! Setting innerHTML directly seems fairly elegant and straightforward to me.

For reference here are a couple of related threads I found in the hyperscript issues:

hyperhype/hyperscript#49
hyperhype/hyperscript#66

In lieu of a beer, if you'd like to open a PR documenting how to add trusted / raw HTML content in the README to save the next person some time, that would be great!

@ungoldman
Copy link
Owner

Here's the equivalent in nanohtml, another hyperscript alternative, for reference:

https://github.com/choojs/nanohtml#interpolating-unescaped-html

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

Successfully merging a pull request may close this issue.

2 participants