MIME type selection in notebook cells.
Right now if I start a new notebook, and first cell I run:
using VegaLite
and second cell
@vlplot(:point, rand(10), rand(10))
it does show an output, but it auto selects the SVG MIME type as the active renderer. The vega-lite MIME type is also there and I can switch to it, but it is not auto selected as the default. We would want the richer MIME type to be used by default, i.e. vega-lite.
@DonJayamanne how can we control MIME type priority here? Is that something we control, or is that something that is controlled in the Jupyter extension? Or somewhere else?
how can we control MIME type priority here? Is that something we control, or is that something that is controlled in the Jupyter extension? Or somewhere else?
You control the priority by controlling the order of the items in the output. Ie. if you have an output with 2 output items, then the highest priority output (mime) type shoudl be on top in the list of output items for that output.
put, but it auto selects the SVG MIME type as the active renderer. The vega-lite MIME
However, when you save this & load it from disc at that point vscode (ipynb renderer) will give preference to the svg as that how Jupyter works today. FYI - The code used to load ipynb files is not in vscode core (not in jupyter extension anymore). See here https://github.com/microsoft/vscode/blob/main/extensions/ipynb/README.md
You control the priority by controlling the order of the items in the output.
Ah, ok, I think our order is actually good now, so that part should work.
However, when you save this & load it from disc at that point vscode (ipynb renderer) will give preference to the svg as that how Jupyter works today.
Would it actually make sense to always use say this order, regardless of whether a notebook file is opened or a cell was just executed? Seems more consistent to always use the same preference order for displaying things, right?
Would it actually make sense to always use say this order, regardless of whether a notebook file is open
Yes, as that lines up with Jupyter. Hence the change would be required at this end in Julia extension, I'd like to work on that if possible.
Hence the change would be required at this end in Julia extension, I'd like to work on that if possible.
I don't understand :) I think the Julia extension now outputs things in the correct order, in particular the same order that has always been used by IJulia.jl.
If I use just the Julia extension and VS Code (but disable the Jupyter extension), things look pretty good. But the moment I also enable the Jupyter extension, things break. For example, showing a simple DataFrame then starts to prioritize the latex MIME type, but the latex rendering also seems broken.
So it seems to me that we don't need to do anything further here in the Julia extension, but that instead the Jupyter extension should
- properly prioritize html over latex MIME types
- use the vega and vega-lite MIME types when loading files from disc instead of PNG or SVG
What would you change here in the extension?