Hi, I have a type that can usually, but not always, be displayed nicely (through Latexify) in the VSCode plot pane. I can use conditionals/error handling in my
Base.show(::IO, ::MIME"juliavscode/html", ::MyType) overload to fall back on
MIME"text/plain" if it turns out that the neat display won’t work. So far, so good, and here is an MWE:
struct MWEType toggle::Bool end function Base.show(io::IO, mime::MIME"juliavscode/html", x::MWEType) if x.toggle print(io, "<h1> Hello there! </h1>") else show(stdout, MIME("text/plain"), x) end end MWEType(true) ## Displays nicely in the plot pane MWEType(false) ## Falls back on a safer display
However, even when I fall back on
stdout, I still generate a new, empty “plot”. Is there a way to avoid this?