Skip to content

Add support for code output scrolling #1057

Open

Description

@edgararuiz

It would be great to add an option to enable the output of a code chunk to be scrollable, and to be able to set the max height of the visible output. The idea would be to be able to set that at the site, document or code chunk level.

Currently, we are able to set that at the site level using the following CSS entry:

.cell-output-stdout {
  overflow-y: scroll;
  max-height: 300px;
}

Activity

  1. added this to the Future milestone on Jun 7, 2022
  2. added
    enhancement
    html
    themes
    on Apr 28, 2024
  3. mcanouil commented on Apr 28, 2024

    @mcanouil
    Collaborator

    FYI, this kind of customisation is quite easy to achieve and way easier to customise using CSS directly.
    Note that this option would be very specific to HTML-based format.

    ---
    format: html
    include-in-header:
      text: |
        <style>
        .cell-output-stdout {
          overflow-y: scroll;
          max-height: 300px;
        }
        </style>
    ---
    
    ```{r}
    #| echo: false
    cat(gsub(" ", "\n", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sagittis posuere ligula sit amet lacinia. Duis dignissim pellentesque magna, rhoncus congue sapien finibus mollis. Ut eu sem laoreet, vehicula ipsum in, convallis erat. Vestibulum magna sem, blandit pulvinar augue sit amet, auctor malesuada sapien. Nullam faucibus leo eget eros hendrerit, non laoreet ipsum lacinia. Curabitur cursus diam elit, non tempus ante volutpat a. Quisque hendrerit blandit purus non fringilla. Integer sit amet elit viverra ante dapibus semper. Vestibulum viverra rutrum enim, at luctus enim posuere eu. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.Nunc ac dignissim magna. Vestibulum vitae egestas elit. Proin feugiat leo quis ante condimentum, eu ornare mauris feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris cursus laoreet ex, dignissim bibendum est posuere iaculis. Suspendisse et maximus elit. In fringilla gravida ornare. Aenean id lectus pulvinar, sagittis felis nec, rutrum risus. Nam vel neque eu arcu blandit fringilla et in quam. Aliquam luctus est sit amet vestibulum eleifend. Phasellus elementum sagittis molestie. Proin tempor lorem arcu, at condimentum purus volutpat eu. Fusce et pellentesque ligula. Pellentesque id tellus at erat luctus fringilla. Suspendisse potenti."))
    ```
  4. cscheid commented on Apr 28, 2024

    @cscheid
    Member

    The one reason to do it in Quarto is so that it works well across all formats for which it's possible. It wouldn't be worth doing it just for HTML, but it might be worth doing it in a way that works in revealjs, dashboard, and html. And we have a scrollable feature in revealjs (https://quarto.org/docs/presentations/revealjs/) so the idea would be to make that class work across other parts of our HTML subsystem, and then advertise it in the feature-format matrix.

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

    enhancementhtmlthemes

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions