Closed clarkevans closed 3 years ago
@clarkevans Although I understand what you mean, I think having HTML being rendered directly in the terminal is simply too convenient (I would argue, more so than reproducible Julia code in the case of Hyperscript.jl). Similar things are done in the standard library by, e.g., Markdown.jl,
julia> using Markdown
julia> md"""
# Hello world
I'm a **paragraph**.
"""
Hello world
≡≡≡≡≡≡≡≡≡≡≡≡≡
I'm a paragraph.
"As a rule of thumb, the single-line show method should print a valid Julia expression for creating the shown object." One suggestion is to use PrettyPrinting.jl to replicate the code tree you'd need to re-generate the object. Alternatively, perhaps there is a function that would take the rendered output and re-construct the node? e.g.
Node("<span>hello</span>")
might be theshow
forspan("hello")
, then thisNode
constructor could return the same object as would be created by@tags; span("hello")
? I'm asking this because when Ishow
Hyperscript objects within a larger structure, I get something that isn't a valid constructor, and hence it violates the rule of thumb above.