Reputation: 305
Here is an example code chunk and it's output.
`{r example, message = F}
for (i in 1:5) {
print(i)
}
`
I would like this to render in my output file without the border box, and without the leading ## [1]
. Is that possible?
Upvotes: 1
Views: 229
Reputation: 946
This solution also removes the border box.
comment
option to remove the ##
character.cat()
instead of print()
to display the output without the R formatting [1]
. You need to specify in cat()
that you want newlines added.<pre>
tag, with the code chunk being of class .r
, and the output chunk being .hljs
. These might change with different themes, but this selector worked for me. pre.hljs
might work alternatively as a selector.Below is a complete .Rmd file that can be knit to an html document
---
title: example.Rmd
output: html_document
---
```{css, echo = FALSE}
pre:not(.r) {
border: 0px;
}
```
```{r, comment = ""}
for (i in 1:5) {
cat(i, "\n")
}
```
Upvotes: 1
Reputation: 79208
Use the following code
{r example, message = FALSE, comment = ''}
for (i in 1:5) {
cat(i, '\n')
}
Upvotes: 0