2
votes

Is there any way possible to include code for different languages in Rmarkdown documents while authoring books using bookdown package? I have looked at the knitr option like engine with possible values like python, awk/gawk and the executable path can be set using engine.path.

```{r, engine='python'}
print "Will this code chunk be hidden?"
```

However, I would like to just insert code (eg: git) in the Rmarkdown document without executing it.

For example, like including in the markdown documents

```git
git init
```
1

1 Answers

4
votes

If you don't want the code to be executed, you can embed it like:

```
code not executed
```

You can also have code highlighting in specific languages:

```css
my_css{}

```

For your git command, this is execution from terminal, so you can highlight it with:

```sh
git init
```