Skip to content

Improve vector rich display #124

Description

@randy3k

While I like to have inline html displays, I really hate the default rich display of vectors. It simply doesn't make any sense to display the vector as a table.
Screen Shot 2020-01-24 at 4 06 48 PM

Is there any way to disable rich display only for specific classes?

Activity

  1. randy3k commented on Jan 25, 2020

    @randy3k
    ContributorAuthor

    I finally came up with this workaround in my ~/.Rprofile

    setHook(
        packageEvent("IRkernel", "onLoad"),
        function(...) {
            repr_text <- function(obj, ...)
                paste0("<pre>", paste0(utils::capture.output(obj), collapse = "\n"), "</pre>")
            evalq(local({
                    registerS3method("repr_html", "integer", repr_text)
                    registerS3method("repr_html", "double", repr_text)
                    registerS3method("repr_html", "character", repr_text)
                }),
                envir = getNamespace("repr")
            )
        }
    )
  2. randy3k commented on Jan 25, 2020

    @randy3k
    ContributorAuthor

    Oh, I guess I understand why vectors are printed as html as default. Without the knowledge of the device width, R could only print up to the default width 80.

    Screen Shot 2020-01-24 at 5 09 28 PM

    But still, I think it is way better than the html.

  3. flying-sheep commented on Jan 25, 2020

    @flying-sheep
    Member

    It used to look better in jupyter notebook because I attach a CSS class. This class is no longer available in jupyter lab. Do you have an idea how to improve that? Can I render a <style> tag next to each <ol> and it’ll work?

  4. changed the title [-]disable rich_display for specific classes[/-] [+]Improve vector rich display[/+] on Jan 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions