nbformat
nbformat copied to clipboard
Clarifying raw_mimetype?
Hi,
When experimenting in a Jupyterlab instance, if I change the "Raw NBConvert Format", it results in for example
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext",
"tags": []
},
"source": []
}
but from the doc here:
{
"cell_type" : "raw",
"metadata" : {
# the mime-type of the target nbconvert format.
# nbconvert to formats other than this will exclude this cell.
"format" : "mime/type"
},
"source" : "[some nbformat output text]"
}
The difference is the former uses raw_mimetype as the key of the mime-type, and later uses format.
Could you clarify the usage of these 2? Thanks!
Looks like a bug in jupyterlab, as in this repo, raw_mimetype does not appear anywhere except this issue. :shrug:
If this is a bug in JupyterLab, it's also a bug in the Classic Notebook and in nbconvert, and has been there for many years, probably since the beginning.
nbconvert has several instances of raw_mimetype: https://github.com/jupyter/nbconvert/search?q=raw_mimetype
Ok, so less bug and more undefined behavior according to nbformat as it appears in the free-for-all metadata section, under an un-reserved key, but is implemented in nbconvert, lab and notebook, while format is a reserved key but is not implemented by any of those downstreams.
Should the solution be releasing a major version of nbconvert that change the spec to raw_mimetype to match the "real world behavior in the wild"?
This will help when someone is implementing according to spec but unaware of the actual usage out there.
Thanks everyone.