Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign default classes for code blocks of source, output, and so on with html_document #2025

Open
3 tasks done
atusy opened this issue Jan 29, 2021 · 0 comments
Open
3 tasks done
Labels
feature a feature request or enhancement next to consider for next release

Comments

@atusy
Copy link
Collaborator

atusy commented Jan 29, 2021

I'm currently working on this issue at https://github.com/atusy/rmarkdown/tree/default-class .

transferred from yihui/knitr#1730 .

What about code blocks generated by chunks have one of the following classes chunk-source, chunk-output, chunk-message, chunk-warning, or chunk-error by default?

This enables easier and precise selections in CSS and JavaScript, which is friendly both for developers and users.

I already implemented it, but am having difficulty in passing tests (atusy/knitr@54db8c4).
So I want to ask if @yihui like my idea and if it is worth working on to pass tests.

Example applications

Cumbersome CSS selections in a PR #1596 can be simplified (https://github.com/atusy/rmarkdown/blob/eb389d721b9f6cddd092234057c98150f70f898f/inst/rmd/h/default.html#L27-L42)

Selection of code blocks to fold by code_folding can be generalized.
Currently, folding is performed on code blocks with certain language classes, which may cause unexpected behavior (#1603).
If folding is performed on code blocks with chunk-source, the unexpected behavior can be suppressed.
In addition, we don't have to update codefolding.js everytime we find additional language to be folded.

There's a request on folding results #1453.
I am currently working on this issue, and seems to be easy.
However, a problem is that choice of folding button, which is currently code and hide.
For folding results, the choice is better to be output and hide.
I want to generate choices conditionally by detecting the code blocks have chunk-source class or chunk-output class.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv cderv added feature a feature request or enhancement next to consider for next release theme: folding related to rmarkdown folding feature and removed theme: folding related to rmarkdown folding feature labels Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement next to consider for next release
Projects
Status: Backlog
Development

No branches or pull requests

2 participants