-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Write display() calls in markdown output #256
base: master
Are you sure you want to change the base?
Conversation
Jupyter notebooks are a bit different because they can store multiple representations. In the case of Markdown I think we should mirror Documenter and only display a single one perhaps. |
I don't remember what Documenter does with explicit display calls, do you know? |
I don't know, but I'll look into it. |
356cd06
to
f26fb3d
Compare
This is working now with images, markdown, and plain text outputs. I don't know the right way to handle displaying the latex. Right now, I simply wrapped it in " |
I will find time to review, but can you comment on what happens if there is an explicit |
The results of the ExampleConsider this example script: struct DF{N} x end
DF(x) = DF{x}(x)
Base.show(io::IO, ::MIME"text/plain", df::DF{1}) = print(io, "DF($(df.x)) as text/plain")
Base.show(io::IO, ::MIME"text/html", df::DF{2}) = print(io, "DF($(df.x)) as text/html")
Base.show(io::IO, ::MIME"image/png", df::DF{3}) = print(io, "DF($(df.x)) as image/png")
Base.show(io::IO, ::MIME"text/markdown", df::DF{4}) = print(io, "DF($(df.x)) as text/markdown")
Base.show(io::IO, ::MIME"text/latex", df::DF{5}) = print(io, "DF($(df.x)) as text/latex")
Base.show(io::IO, ::MIME"image/svg+xml", df::DF{6}) = print(io, "DF($(df.x)) as image/svg+xml")
Base.show(io::IO, ::MIME"image/png", df::DF{7}) = print(io, "DF($(df.x)) as image/png")
#-
foreach(display, DF(i) for i in 1:6)
DF(7) Notebook (as generated)The generated notebook can't display the images because they aren't valid, and the markdown and svg output aren't right. Notebook (after running kernel)If I run the kernel, the markdown and is more correct, although I'm not sure it they should look like. And the svg doesn't show up, probably due to being invalid. Markdown (
|
@fredrikekre I made some changes to get the
display()
calls rendered for the markdown output, but I don't understand the multiple MIMEs for the samedisplay()
call. And I don't understand the use for thesplit_mime()
call.So this is an initial fix, but it seems to duplicate output to both plain text and HTML. Can you advise on the correct behavior?
Fixes #255