MyST-NB
MyST-NB copied to clipboard
[Latex] Update transform to skip and warn for incompatible objects from mime bundles
Is your feature request related to a problem? Please describe.
When building latex
there are certain objects that may be incompatible with the static document concept that pdf
provides (i.e. animated gif files). We should add sphinx warnings and raise SkipNode
for bundles that contain incompatible objects that aren't listed in the priority list
Describe the solution you'd like
This will need to modify cell_output_to_nodes and cell_output_to_nodes_inline
cell_output_to_nodes
is contained in jupyter-sphinx.
Discussion Points:
@choldgraf what is the difference between cell_output_to_nodes
and the _inline
version in myst-nb
? We will need to pass a builder
context to these functions to allow detection when running the latex
builder so that we can apply this in context.
This might be a nice opportunity to upstream the _inline
version if that is the correct place for it to live, but I am a little confused with roles and responsibilities here. Is it documented what we rely on jupyter_sphinx
for?
@choldgraf I see that jupinx-sphinx
is in jupyter
organisation so failed to push a branch to it. Should I use a fork
to make a PR for the upstream of cell_output_to_nodes_inline
?
@mmcky perhaps you want to close this, or reclarify it purpose, given that rendering process is now reasonably different
hey @chrisjsewell this issue was really about supporting rich mime
types such as svg
graphics in LaTeX
side. There are a few ways to tackle this issue on the LaTeX
side such as svg
package support in preamble (those packages convert the svg images using something like imagemagic
) or conversion to a static image format such as png
as a sphinx transform
(which is probably the better way to go).
Has this changed with recent updates?
Is it mainly SVG, or is there any other MIME types you have in mind? Otherwise, this is a duplicate of #178
On the user feedback side, currently we do not warn if a MIME bundle contains no type present in the priority list, because this was incompatible with the glue stuff (at least for a simple check):
https://github.com/executablebooks/MyST-NB/blob/4b3f51f20dedc8a96c8371341a3f0d8201dce610/myst_nb/render_outputs.py#L172-L180
We do warn though if no renderer is available for a MIME type:
https://github.com/executablebooks/MyST-NB/blob/4b3f51f20dedc8a96c8371341a3f0d8201dce610/myst_nb/render_outputs.py#L266-L270
We can certainly add more MIME type renderers or LaTeX specific renderers into the process now, either on the "default" renderer, or as a separate renderer subclass that the user would switch to with the nb_render_plugin
config option