Skip to content

[FR] Add option to customize code-folding "Show"/"Hide" button text #2613

@zachary-foster

Description

@zachary-foster

The code folding feature is quite useful, but I think its appearance could be improved. The button says "Show", which is a reasonable default given that what is folded may not be code. However, this ambiguity means that if all the code in folded in a document, it is not clear what "Show" actually does.

Others have wanted this functionality as well:

https://forum.posit.co/t/text-in-the-button-to-show-hide-code/187673

And some formats have circumvented this issue:

https://rstudio.github.io/distill/

Image

They do this with a YAML header option:

---
output:
  distill::distill_article:
    code_folding: "Show/Hide Code"
---

Ideally, I think this would be a chunk option, since a single document could have different types of things, code or otherwise, folded. Also, the way distill formats the button as text with a rotating arrow looks cleaner and more modern to me.

If there is interest in this feature, I would be happy to work on it and submit a PR to address it.

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