Skip to content

Add attributes as code cells option (alongside classes) #6253

Closed

Description

@mcanouil

Discussed in #5587

Originally posted by mcanouil May 17, 2023
From #5456 and yihui/knitr#2256, I believe it would be very useful to be able to add any kind of attributes and not only classes to cell container.
For instance, knitr offers class-* and the general attr-* options to customise code cells.

This attributes could help leverage many Bootstrap features already embedded in Quarto, such as popover or tooltip which uses data-bs-* attributes.

Activity

  1. added
    enhancement
    html
    on Jul 17, 2023
  2. dragonstyle commented on Nov 28, 2023

    @dragonstyle
    Collaborator

    Currently, any non-Quarto attributes that are present in the Quarto metadata for code cells will be included in the output code cell div as a 'data' attribute. For example:

    ```{r}
    #| label: fig-cars
    #| bs-parent: "#my-parent"
    plot(cars)
    ```

    results in:

    <div class="cell" data-bs-parent="#my-parent">
    ...
    </div>

    I think this should be enough (and so I'm closing this), but re-open if there is more we need to do!

  3. added this to the v1.4 milestone on Jun 10, 2024
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

    enhancementhtml

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions