Skip to content

[Feature request] Add option to define code button alignment #270

@fschaffner

Description

@fschaffner

Many thanks for creating and maintaining this package!

Would it be possible to add an option that defines where on the page the "Show code" button will be located if using the option "code-fold: true" when rendering HTML? I find that having the code button on the left breaks my reading flow, and I would prefer if the button was located in the center or on the right of the page.

I would propose to add an option "code-align" with can take the values "left", "center", or "right" (as illustrated below).

Apologies if this feature already exists, I couldn't find it in the documentation.

---
title: "Title"
format:
  html:
    code-fold: true
    code-summary: "Show code"
    code-align: "right" # Proposed options: "left", "center", "right"
---

```{r}
library("ggplot2")
dat <- data.frame(cond = rep(c("A", "B"), each=10),
                  xvar = 1:20 + rnorm(20,sd=3),
                  yvar = 1:20 + rnorm(20,sd=3))

ggplot(dat, aes(x=xvar, y=yvar)) +
    geom_point(shape=1) + 
    geom_smooth() 
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions