dataframe icon indicating copy to clipboard operation
dataframe copied to clipboard

Support both `text/html` and `text/plain` for Jupyter output

Open ileasile opened this issue 4 years ago • 0 comments

Standard Jupyter output is a JSON object that has the following structure:

{
    mimetype1: value1,
    mimetype2: value2,
    ...
}

Jupyter client chooses one of these mimetypes for rendering. Web-based clients support both text/html and text/plain, but will prefer HTML over plain text. Console clients support only text/plain, so they will choose it. Jupyter client in Dataspell/IDEA requires BOTH for now - it's a bug and I filed an issue about it: https://youtrack.jetbrains.com/issue/DS-2920. But it really makes sense to pass both variants. BTW, it's not hard to achieve as we already have support for rendering to HTML and plain text. We only need some modifications for HtmlData class, I believe.

Just a note: pandas passes both HTML and plain data for tables, take a look at this notebook, for example: https://raw.githubusercontent.com/StrikingLoo/pandas_workshop/master/generate_dataset.ipynb

ileasile avatar Dec 22 '21 12:12 ileasile