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

Raw string rendering #14

Closed
tshort opened this issue Jun 5, 2019 · 3 comments
Closed

Raw string rendering #14

tshort opened this issue Jun 5, 2019 · 3 comments

Comments

@tshort
Copy link
Contributor

tshort commented Jun 5, 2019

I need to output un-encoded strings that include raw HTML. This is easy enough to implement externally:

struct Raw
    str::String
end
Base.show(io::IO, m::MIME"text/html", rawstr::Raw) = print(io, rawstr.str)

Example:

julia> m("div", Raw("<span>hi</span>"))
<div><span>hi</span></div>

Is there any interest in having this in Hyperscript?

@yurivish
Copy link
Collaborator

yurivish commented Jun 5, 2019

I was going to mention @tags_noescape, and m(Hyperscript.NOESCAPE_HTMLSVG_CONTEXT, "div", "<span>hi</span>"), but doesn't your last PR actually solve this for us?

julia> @tags div

julia> div("<span>hi</span>")
<div>&#60;span&#62;hi&#60;/span&#62;</div>

julia> div(HTML("<span>hi</span>"))
<div><span>hi</span></div>

@tshort
Copy link
Contributor Author

tshort commented Jun 5, 2019

Nice! Thanks, @yurivish.

@tshort tshort closed this as completed Jun 5, 2019
@tshort
Copy link
Contributor Author

tshort commented Jun 5, 2019

Thanks also for the reminder on @tags_noescape. That will be helpful for me in another scenario.

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

2 participants