Skip to content

let display() not use jupyter.rich_display #28

@jankatins

Description

@jankatins

We currently define displayas:

#' Display an object using any available reprs
#'
#' @param obj  The object to be displayed
#' @importFrom repr mime2repr repr_text
#' @export
display <- function (obj) {
    data <- namedlist()
    if (getOption('jupyter.rich_display')) {
        for (mime in getOption('jupyter.display_mimetypes')) {
            r <- mime2repr[[mime]](obj)
            if (!is.null(r)) data[[mime]] <- r
        }
    } else {
        data[['text/plain']] <- repr_text(obj)
    }
    publish_mimebundle(data)
}

I would like to shorten that to

#' Display an object using any available reprs
#'
#' @param obj  The object to be displayed
#' @importFrom repr mime2repr repr_text
#' @export
display <- function (obj) {
    data <- namedlist()
    for (mime in getOption('jupyter.display_mimetypes')) {
        r <- mime2repr[[mime]](obj)
        if (!is.null(r)) data[[mime]] <- r
    }
    publish_mimebundle(data)
}

This would mean that I can remove the auto rich display output (jupyter.rich_display = FALSE) and could still use display(something) and get all available output. That would in line with display_XXX which do not honor this option (and rightly so). It would also be more in line of the current doc string: "using any available reprs".

This would also mean that jupyter.rich_display would be an option of the kernel alone and not of the IRdisplay package. IMO it could then be renamed to jupyter.auto_rich_display.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions