Repository navigation
Closed
Labels
engines-knitrAnything regarding knitr enginessupporta request for supportupstreamBug is in upstream library
Description
Bug description
Adding the attr-output option in an R chunk has no effect on the rendered html (i.e., the attribute does not get added).
Reprex:
```{r}
#| error: true
#| warning: true
#| message: true
#| attr-output: "style='color: blue;'"
#| attr-error: "style='color: yellow;'"
#| attr-warning: "style='color: orange;'"
#| attr-message: "style='color: green;'"
#| results: asis
cat("something")
stop("something")
warning("something")
message("something")
```
Quarto check:
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.340
Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.9.6
Path: /Library/Developer/CommandLineTools/usr/bin/python3
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
[✓] Checking R installation...........OK
Version: 4.3.0
Path: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources
LibPaths:
- /Users/andyteucher/Library/R/arm64/4.3/library
- /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
knitr: 1.42
rmarkdown: 2.21
[✓] Checking Knitr engine render......OK
Checklist
- Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- Please format your issue so it is easier for us to read the bug report.
- Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- Please document the operating system you're running. If on Linux, please provide the specific distribution.
- Please provide the output of
quarto checkso we know which version of quarto and its dependencies you're running.
Metadata
Metadata
Assignees
Labels
engines-knitrAnything regarding knitr enginessupporta request for supportupstreamBug is in upstream library

Activity
mcanouil commentedon May 8, 2023
FYI, I opened an issue upstream since the behaviour is the same using
rmarkdown, see yihui/knitr#2256.cderv commentedon May 9, 2023
@ateucher let me put also here the answer I give upstream at yihui/knitr#2256 (comment) but using Quarto example
This is just happening in your example because you are using
results: asisThis means no code chunk output will be created by knitr to put the attributes on. It will be output asis in the resulting document. So that is expected for this specific usage.
See this example showing the difference
And intermediate source code
There is no issue here - just an unexpected usage of
attr.output. For message, error and warning,asisdoes not apply so that is why you get the correct wrapping in.mdfile with correct class.I'll look closer at your original slack message for the original issue with
out-extramcanouil commentedon May 11, 2023
Source: yihui/knitr#2256 (comment)
To continue on discussing the possible addition of
attributesalongsideclassesas a more general approach (not tied up toknitr) to add any kind of attributes (including classes) on code cells.cderv commentedon May 11, 2023
@mcanouil Le'ts create a specific feature request for this with some example on expected results and why it would be useful. This issue is initially about a related problem but not directly to this idea of yours. I think that would be easier to track.
mcanouil commentedon May 11, 2023
True, I hesitated.
Although this issue itself seems "resolved", isn't it? ("close as not planned")
cderv commentedon May 11, 2023
Yes exactly, if you open a new one , I'll close this one.
mcanouil commentedon May 17, 2023
I am closing this as resolved.
For discussion about the global code cell
attributesoption feature request, see #5587