Open divyansshhh opened 2 years ago
Could you provide an example? Here is where we interrogate and choose between mime types for cell output: https://github.com/quarto-dev/quarto-cli/blob/254acfe257b08c7ee7b372060100c0a56c608391/src/core/jupyter/display-data.ts#L40
If there is a type not anticipated then we probably don't do anything with it. If you provide an example then I can see what we might be able to do better / what type of hooks we could provide to make it possible for users to handle explicitly.
Let's say I have the geojson-extension which handles the rendering of application/geo+json
mime-type in jupyter-lab.
Now what I want is that when such a mime-type is encountered, which isn't in the src/mime.ts, I should be able to write some code to process it differently. In this example, I might want to convert that into an image.
Okay, I see that. One issue I see here is that by using the geojson extension you are hard-binding your notebook to Jupyter Lab. If you open the notebook in VS Code, Pycharm, Classic Jupyter NB, Google Colab etc. then the Geojson doesn't display. Quarto falls into the same category. Ideally you would take the GeoJSON and render it w/ something like ipyleaflet, which would then work fine in all of the above environments including Quarto.
geojson-extension was just an example. This would actually affect any mime-renderers written for jupyterlab. I was looking at the documentation for quarto, do you think a custom filter would help in this case?
Also, I do agree that geojson wouldn't render on the other platforms but I am only concerned with jupyterlab.
Okay, I think what you want is a notebook filter, which will give you the raw JSON which you can manipulate as you wish using nbformat (e.g. replacing the geojson output with an image). See https://quarto.org/docs/authoring/filters.html#notebook-filters
Does
quarto
support converting custom mime-types to pdf? Maybe something like preprocessors in nbconvert?Currently if I have a custom mime-type it just returns the object type in PDF and Docx formats.