Overriding display of composite type

question

#1

I’m trying to do something like this on Atom environment.

using Juno

struct Foo
    a
    b
end

function Base.show(io::IO, x::Foo) 
    display(Juno.Tree("this is...", [x.a, x.b, "some extra info"]))
end

which displays what I expected it to do, but being duplicated like this

example
I know It’s not right to override display inside show function, but couldn’t figure out proper way to do this.
What should I do to override tree view like this? Any tip or link to documentation would be greatly appreciated.

Thanks!


#2

I found solution from google search

This code works for me

struct Foo
    a
    b
end

function Media.render(i::Juno.Inline, x::Foo)
    Media.render(i, Juno.Tree("this is...", [x.a, x.b, "some extra info"]))
end