nbformat icon indicating copy to clipboard operation
nbformat copied to clipboard

Clarifying raw_mimetype?

Open ickc opened this issue 4 years ago • 4 comments
trafficstars

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!

ickc avatar Sep 09 '21 04:09 ickc

Looks like a bug in jupyterlab, as in this repo, raw_mimetype does not appear anywhere except this issue. :shrug:

bollwyvl avatar Sep 09 '21 13:09 bollwyvl

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

mgeier avatar Sep 09 '21 14:09 mgeier

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.

bollwyvl avatar Sep 09 '21 15:09 bollwyvl

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.

ickc avatar Sep 09 '21 21:09 ickc