我尝试使用反引号和波浪号,但是它们需要语言。我只想要带有突出显示背景的纯文本格式的代码块。
使用eval=FALSE
和tidy=FALSE
直到找到诸如之类的关键字if
,随后的代码将在.Rmd
文件和输出PDF中以彩色突出显示。如果未通过选项指定语言,则将无法在背景中突出显示代码。
```{r, eval=FALSE,tidy=FALSE}
loop through each species
loop through each measurement of the current species
if measurement ...
etc.
```
这是一些可以很好地呈现为HTML的示例代码。它还可以正确呈现为Word和PDF。
---
title: "Untitled"
output: html_document
---
Here is some plain text.
Next, let's write some pseudo code. Note that you don't _have_ to specify a language if using plain backticks.
```
object <- [some kind of calculation]
```
If you set `eval = FALSE` you can get the highlighted background
```{r, eval = FALSE}
object <- [some kind of calculation]
Note that this; is not valid R code
```
You may find it interesting that your example works just fine for me.
```{r, eval=FALSE}
loop through each species
loop through each measurement of the current species
...
etc.
```
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句