-
-
Notifications
You must be signed in to change notification settings - Fork 878
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 #1730
Comments
Adding default classes to message, warning, and error messages sounds good to me. For source and output, I'm not quite sure, since it will certainly break some tests. Before I submit the next version of knitr to CRAN, I'll have to check all reverse dependencies. At that time, I might discover packages broken due to this change. I just want to let you know in advance that there is a (small) chance that I'll have to revert this feature. |
Thank you for the reply.
Yes, this is the point. |
I don't mind updating tests in knitr, since this package is completely under my control. The problem is other people's packages and applications. |
That's right. I'll check revdeps, but I'm not sure I can make it before releasing next |
There is no urgency about this issue. |
Alright 👍 |
Oh, I was forgetting about this PR for long time. Now I feel this PR should go to rmarkdown package, i.e., add default classes with chunk hooks because of @yihui's comment on |
That sounds good to me. |
@atusy should we close this in favor of a PR in rmarkdown ? If so we could open an issue there, and reopen this one if we reconsider. What to you think ? |
@cderv Thanks. I'll open the issue later. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
What about code blocks generated by chunks have one of the following classes
chunk-source
,chunk-output
,chunk-message
,chunk-warning
, orchunk-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@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 rstudio/rmarkdown#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 (rstudio/rmarkdown#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 rstudio/rmarkdown#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
andhide
.For folding results, the choice is better to be
output
andhide
.I want to generate choices conditionally by detecting the code blocks have
chunk-source
class orchunk-output
class.xfun::session_info('knitr')
By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. 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('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: